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

@ -48,7 +48,7 @@ class Event_Query extends Query {
* @access public
* @var string
*/
protected $table_schema = '\\WP_Ultimo\\Database\\Events\\Events_Schema';
protected $table_schema = \WP_Ultimo\Database\Events\Events_Schema::class;
/** Item ******************************************************************/
@ -77,7 +77,7 @@ class Event_Query extends Query {
* @access public
* @var mixed
*/
protected $item_shape = '\\WP_Ultimo\\Models\\Event';
protected $item_shape = \WP_Ultimo\Models\Event::class;
/**
* Group to cache queries and queried items in.
@ -104,7 +104,7 @@ class Event_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

@ -28,9 +28,9 @@ class Events_Schema extends Schema {
* @access public
* @var array
*/
public $columns = array(
public $columns = [
array(
[
'name' => 'id',
'type' => 'bigint',
'length' => '20',
@ -38,62 +38,62 @@ class Events_Schema extends Schema {
'extra' => 'auto_increment',
'primary' => true,
'sortable' => true,
),
],
array(
[
'name' => 'severity',
'type' => 'tinyint',
'length' => '1',
'unsigned' => true,
'sortable' => true,
),
],
array(
[
'name' => 'initiator',
'type' => 'enum(\'system\', \'manual\')',
'default' => 'none',
),
],
array(
[
'name' => 'author_id',
'type' => 'bigint',
'length' => '20',
'unsigned' => true,
'sortable' => true,
'transition' => true,
),
],
array(
[
'name' => 'object_type',
'type' => 'varchar',
'length' => 20,
'default' => 'network',
'sortable' => true,
'searchable' => true,
),
],
array(
[
'name' => 'object_id',
'type' => 'bigint',
'length' => '20',
'unsigned' => true,
'sortable' => true,
'transition' => true,
),
],
array(
[
'name' => 'slug',
'type' => 'longtext',
'default' => '',
),
],
array(
[
'name' => 'payload',
'type' => 'longtext',
'default' => '',
),
],
array(
[
'name' => 'date_created',
'type' => 'datetime',
'default' => null,
@ -101,7 +101,7 @@ class Events_Schema extends Schema {
'date_query' => true,
'sortable' => true,
'allow_null' => true,
),
],
);
];
}

View File

@ -50,9 +50,9 @@ final class Events_Table extends Table {
*
* @var array
*/
protected $upgrades = array(
protected $upgrades = [
'2.0.1-revision.20230601' => 20_230_601,
);
];
/**
* Event constructor.
@ -73,7 +73,7 @@ final class Events_Table extends Table {
* @since 2.0.0
* @return void
*/
protected function set_schema() {
protected function set_schema(): void {
$this->schema = "id bigint(20) NOT NULL auto_increment,
severity tinyint(4),
@ -96,9 +96,9 @@ final class Events_Table extends Table {
*/
protected function __20230601(): bool {
$null_columns = array(
$null_columns = [
'date_created',
);
];
foreach ($null_columns as $column) {
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";