Use PHP 7.4 featers and PHP 8 polyfills

This commit is contained in:
David Stone
2025-02-08 13:57:32 -07:00
parent 8bea6067cd
commit b41dc2b2eb
550 changed files with 15270 additions and 14627 deletions

View File

@ -29,12 +29,12 @@ class Invoice_List_Table extends Parent_Payment_List_Table {
*/
public function get_columns() {
$columns = array(
$columns = [
'hash' => __('Code', 'wp-ultimo'),
'status' => __('Status', 'wp-ultimo'),
'total' => __('Total', 'wp-ultimo'),
'date_created' => __('Created at', 'wp-ultimo'),
);
];
return $columns;
}
@ -49,6 +49,6 @@ class Invoice_List_Table extends Parent_Payment_List_Table {
*/
public function bulk_actions($which = '') {
return array();
return [];
}
}

View File

@ -30,9 +30,9 @@ class Product_List_Table extends Parent_Product_List_Table {
parent::__construct();
$this->modes = array(
$this->modes = [
'grid' => __('Grid View'),
);
];
$this->current_mode = 'grid';
}
@ -45,7 +45,7 @@ class Product_List_Table extends Parent_Product_List_Table {
*/
public function get_columns() {
return array();
return [];
}
/**
@ -55,10 +55,10 @@ class Product_List_Table extends Parent_Product_List_Table {
*/
public function get_filters(): array {
return array(
'filters' => array(),
'date_filters' => array(),
);
return [
'filters' => [],
'date_filters' => [],
];
}
/**
@ -71,7 +71,7 @@ class Product_List_Table extends Parent_Product_List_Table {
*/
public function bulk_actions($which = '') {
return array();
return [];
}
/**
@ -82,14 +82,14 @@ class Product_List_Table extends Parent_Product_List_Table {
* @param WP_Ultimo\Models\Customer $item The customer being shown.
* @return void
*/
public function single_row_grid($item) {
public function single_row_grid($item): void {
wu_get_template(
'base/products/grid-item',
array(
[
'item' => $item,
'list_table' => $this,
)
]
);
}
}

View File

@ -30,9 +30,9 @@ class Site_List_Table extends Parent_Site_List_Table {
parent::__construct();
$this->modes = array(
$this->modes = [
'grid' => __('Grid View'),
);
];
$this->current_mode = 'grid';
}
@ -45,7 +45,7 @@ class Site_List_Table extends Parent_Site_List_Table {
*/
public function get_columns() {
return array();
return [];
}
/**
@ -55,10 +55,10 @@ class Site_List_Table extends Parent_Site_List_Table {
*/
public function get_filters(): array {
return array(
'filters' => array(),
'date_filters' => array(),
);
return [
'filters' => [],
'date_filters' => [],
];
}
/**
@ -69,14 +69,14 @@ class Site_List_Table extends Parent_Site_List_Table {
*/
public function get_views() {
return array(
'all' => array(
return [
'all' => [
'field' => 'type',
'url' => add_query_arg('type', 'all'),
'label' => __('Your Sites', 'wp-ultimo'),
'count' => 0,
),
);
],
];
}
/**
@ -90,21 +90,21 @@ class Site_List_Table extends Parent_Site_List_Table {
$customer = wu_get_current_customer();
if ( ! $customer) {
return array(
'blog_id__in' => array('null_id'), // pass absurd value to make sure the query returns nothing.
);
return [
'blog_id__in' => ['null_id'], // pass absurd value to make sure the query returns nothing.
];
}
$fields = parent::get_extra_fields();
$fields = array(
'meta_query' => array(
'customer_id' => array(
$fields = [
'meta_query' => [
'customer_id' => [
'key' => 'wu_customer_id',
'value' => $customer->get_id(),
),
),
);
],
],
];
return $fields;
}