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 Webhook_Query extends Query {
* @access public
* @var string
*/
protected $table_schema = '\\WP_Ultimo\\Database\\Webhooks\\Webhooks_Schema';
protected $table_schema = \WP_Ultimo\Database\Webhooks\Webhooks_Schema::class;
/** Item ******************************************************************/
@ -77,7 +77,7 @@ class Webhook_Query extends Query {
* @access public
* @var mixed
*/
protected $item_shape = '\\WP_Ultimo\\Models\\Webhook';
protected $item_shape = \WP_Ultimo\Models\Webhook::class;
/**
* Group to cache queries and queried items in.
@ -104,7 +104,7 @@ class Webhook_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 Webhooks_Schema extends Schema {
* @access public
* @var array
*/
public $columns = array(
public $columns = [
array(
[
'name' => 'id',
'type' => 'bigint',
'length' => '20',
@ -38,48 +38,48 @@ class Webhooks_Schema extends Schema {
'extra' => 'auto_increment',
'primary' => true,
'sortable' => true,
),
],
array(
[
'name' => 'migrated_from_id',
'type' => 'bigint',
'length' => '20',
'unsigned' => true,
'sortable' => true,
'allow_null' => true,
),
],
array(
[
'name' => 'name',
'type' => 'varchar',
'searchable' => true,
'sortable' => true,
),
],
array(
[
'name' => 'webhook_url',
'type' => 'varchar',
'searchable' => true,
'sortable' => true,
),
],
array(
[
'name' => 'event',
'type' => 'varchar',
'searchable' => true,
'sortable' => true,
),
],
array(
[
'name' => 'event_count',
'type' => 'int',
'length' => '10',
'default' => 0,
'sortable' => true,
'aliases' => array('sent_events_count'),
),
'aliases' => ['sent_events_count'],
],
array(
[
'name' => 'active',
'type' => 'tinyint',
'length' => '4',
@ -87,9 +87,9 @@ class Webhooks_Schema extends Schema {
'default' => 1,
'transition' => true,
'sortable' => true,
),
],
array(
[
'name' => 'hidden',
'type' => 'tinyint',
'length' => '4',
@ -97,31 +97,31 @@ class Webhooks_Schema extends Schema {
'default' => 0,
'transition' => true,
'sortable' => true,
),
],
array(
[
'name' => 'integration',
'type' => 'varchar',
'searchable' => true,
'sortable' => true,
),
],
array(
[
'name' => 'date_last_failed',
'type' => 'datetime',
'date_query' => true,
'sortable' => true,
),
],
array(
[
'name' => 'date_created',
'type' => 'datetime',
'created' => true,
'date_query' => true,
'sortable' => true,
),
],
array(
[
'name' => 'date_modified',
'type' => 'datetime',
'default' => null,
@ -129,7 +129,7 @@ class Webhooks_Schema extends Schema {
'date_query' => true,
'sortable' => true,
'allow_null' => true,
),
],
);
];
}

View File

@ -50,9 +50,9 @@ final class Webhooks_Table extends Table {
*
* @var array
*/
protected $upgrades = array(
protected $upgrades = [
'2.0.1-revision.20230601' => 20_230_601,
);
];
/**
* Webhook constructor.
@ -73,7 +73,7 @@ final class Webhooks_Table extends Table {
* @since 2.0.0
* @return void
*/
protected function set_schema() {
protected function set_schema(): void {
// phpcs:disable
@ -101,10 +101,10 @@ final class Webhooks_Table extends Table {
*/
protected function __20230601(): bool {
$null_columns = array(
$null_columns = [
'date_created',
'date_modified',
);
];
foreach ($null_columns as $column) {
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";