Use PHP 7.4 featers and PHP 8 polyfills
This commit is contained in:
@ -48,7 +48,7 @@ class Checkout_Form_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Checkout_Forms\\Checkout_Forms_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Checkout_Forms\Checkout_Forms_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Checkout_Form_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Checkout_Form';
|
||||
protected $item_shape = \WP_Ultimo\Models\Checkout_Form::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Checkout_Form_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ final class Checkout_Forms_Meta_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$max_index_length = 191;
|
||||
|
||||
|
@ -28,9 +28,9 @@ class Checkout_Forms_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -38,26 +38,26 @@ class Checkout_Forms_Schema extends Schema {
|
||||
'extra' => 'auto_increment',
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'name',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'slug',
|
||||
'type' => 'tinytext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'active',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -65,31 +65,31 @@ class Checkout_Forms_Schema extends Schema {
|
||||
'default' => 1,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'settings',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
'transition' => true,
|
||||
'allow_null' => false,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'custom_css',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'allowed_countries',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_created',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -97,9 +97,9 @@ class Checkout_Forms_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_modified',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -107,7 +107,7 @@ class Checkout_Forms_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ final class Checkout_Forms_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 Checkout_Forms_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,
|
||||
name tinytext NOT NULL DEFAULT '',
|
||||
@ -93,10 +93,10 @@ final class Checkout_Forms_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;";
|
||||
|
Reference in New Issue
Block a user