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

@ -56,7 +56,7 @@ class Site_Query extends Query {
* @access public
* @var string
*/
protected $table_schema = '\\WP_Ultimo\\Database\\Sites\\Sites_Schema';
protected $table_schema = \WP_Ultimo\Database\Sites\Sites_Schema::class;
/** Item ******************************************************************/
@ -85,7 +85,7 @@ class Site_Query extends Query {
* @access public
* @var mixed
*/
protected $item_shape = '\\WP_Ultimo\\Models\\Site';
protected $item_shape = \WP_Ultimo\Models\Site::class;
/**
* Group to cache queries and queried items in.
@ -112,7 +112,7 @@ class Site_Query extends Query {
*
* @param string|array $query Array of query arguments.
*/
public function __construct($query = array()) {
public function __construct($query = []) {
parent::__construct($query);
}

View File

@ -41,14 +41,14 @@ class Site_Type extends Enum {
*/
protected function classes() {
return array(
return [
static::REGULAR => 'wu-bg-gray-700 wu-text-gray-200',
static::SITE_TEMPLATE => 'wu-bg-yellow-200 wu-text-yellow-700',
static::CUSTOMER_OWNED => 'wu-bg-green-200 wu-text-green-700',
static::PENDING => 'wu-bg-purple-200 wu-text-purple-700',
static::EXTERNAL => 'wu-bg-blue-200 wu-text-blue-700',
static::MAIN => 'wu-bg-pink-200 wu-text-pink-700',
);
];
}
/**
@ -59,12 +59,12 @@ class Site_Type extends Enum {
*/
protected function labels() {
return array(
return [
static::REGULAR => __('Regular Site', 'wp-ultimo'),
static::SITE_TEMPLATE => __('Site Template', 'wp-ultimo'),
static::CUSTOMER_OWNED => __('Customer-Owned', 'wp-ultimo'),
static::PENDING => __('Pending', 'wp-ultimo'),
static::MAIN => __('Main Site', 'wp-ultimo'),
);
];
}
}

View File

@ -72,7 +72,7 @@ final class Sites_Meta_Table extends Table {
* @since 2.0.0
* @return void
*/
protected function set_schema() {
protected function set_schema(): void {
$this->schema = false;
}

View File

@ -36,9 +36,9 @@ class Sites_Schema extends Schema {
* @access public
* @var array
*/
public $columns = array(
public $columns = [
array(
[
'name' => 'blog_id',
'type' => 'bigint',
'length' => '20',
@ -46,33 +46,33 @@ class Sites_Schema extends Schema {
'extra' => 'auto_increment',
'primary' => true,
'sortable' => true,
'aliases' => array('id', 'ID'),
'aliases' => ['id', 'ID'],
'searchable' => true,
),
],
array(
[
'name' => 'site_id',
'type' => 'bigint',
'length' => '20',
'unsigned' => true,
'sortable' => true,
),
],
array(
[
'name' => 'domain',
'type' => 'varchar',
'searchable' => true,
'sortable' => true,
),
],
array(
[
'name' => 'path',
'type' => 'varchar',
'searchable' => true,
'sortable' => true,
),
],
array(
[
'name' => 'registered',
'type' => 'datetime',
'default' => '0000-00-00 00:00:00',
@ -80,9 +80,9 @@ class Sites_Schema extends Schema {
'date_query' => true,
'sortable' => true,
'allow_null' => true,
),
],
array(
[
'name' => 'last_updated',
'type' => 'datetime',
'default' => '0000-00-00 00:00:00',
@ -90,61 +90,61 @@ class Sites_Schema extends Schema {
'date_query' => true,
'sortable' => true,
'allow_null' => true,
),
],
array(
[
'name' => 'public',
'type' => 'tinyint',
'length' => '2',
'unsigned' => true,
'default' => 1,
'sortable' => true,
),
],
array(
[
'name' => 'archived',
'type' => 'tinyint',
'length' => '2',
'unsigned' => true,
'default' => 0,
'sortable' => true,
),
],
array(
[
'name' => 'mature',
'type' => 'tinyint',
'length' => '2',
'unsigned' => true,
'default' => 0,
'sortable' => true,
),
],
array(
[
'name' => 'spam',
'type' => 'tinyint',
'length' => '2',
'unsigned' => true,
'default' => 0,
'sortable' => true,
),
],
array(
[
'name' => 'deleted',
'type' => 'tinyint',
'length' => '2',
'unsigned' => true,
'default' => 0,
'sortable' => true,
),
],
array(
[
'name' => 'lang_id',
'type' => 'int',
'length' => '11',
'unsigned' => true,
'default' => 0,
'sortable' => true,
),
],
);
];
}

View File

@ -72,7 +72,7 @@ final class Sites_Table extends Table {
* @since 2.0.0
* @return void
*/
protected function set_schema() {
protected function set_schema(): void {
$this->schema = false;
}
@ -82,5 +82,5 @@ final class Sites_Table extends Table {
*
* @since 2.0.0
*/
public function install() {}
public function install(): void {}
}