Everywhere yoda conditions are

This commit is contained in:
David Stone
2025-02-09 00:20:10 -07:00
parent d74f6d1a53
commit be0ab98895
213 changed files with 691 additions and 412 deletions

View File

@ -86,6 +86,7 @@ final class Checkout_Forms_Table extends Table {
date_modified datetime DEFAULT NULL,
PRIMARY KEY (id)";
}
/**
* Fixes the datetime columns to accept null.
*

View File

@ -93,6 +93,7 @@ final class Discount_Codes_Table extends Table {
date_modified datetime NULL,
PRIMARY KEY (id)";
}
/**
* Fixes the datetime columns to accept null.
*

View File

@ -27,9 +27,13 @@ class Domain_Stage extends Enum {
const __default = 'checking-dns'; // phpcs:ignore
const FAILED = 'failed';
const CHECKING_DNS = 'checking-dns';
const CHECKING_SSL = 'checking-ssl-cert';
const DONE_WITHOUT_SSL = 'done-without-ssl';
const DONE = 'done';
/**

View File

@ -88,6 +88,7 @@ final class Domains_Table extends Table {
KEY blog_id (blog_id,domain,active),
KEY domain (domain)";
}
/**
* Fixes the datetime columns to accept null.
*

View File

@ -23,6 +23,7 @@ abstract class Enum {
* The default value.
*/
const __default = false;
// phpcs:ignore
/**
* The options available.
@ -31,10 +32,12 @@ abstract class Enum {
* @var array
*/
static $options = [];
/**
* @var string
*/
private $value = '';
/**
* Constructor method. Takes the value you want to set.
*
@ -54,6 +57,7 @@ abstract class Enum {
* @return array
*/
abstract protected function classes();
/**
* Returns an array with values => labels.
*
@ -61,6 +65,7 @@ abstract class Enum {
* @return void
*/
abstract protected function labels();
/**
* Returns an array with values => labels.
*
@ -186,7 +191,7 @@ abstract class Enum {
static $instance;
if ($instance === null) {
if (null === $instance) {
$instance = new static();
}

View File

@ -51,11 +51,7 @@ abstract class Table extends \BerlinDB\Database\Table {
return false;
}
if ( ! is_main_site()) {
return false;
}
return true;
return (bool) is_main_site();
}
/**

View File

@ -89,6 +89,7 @@ final class Events_Table extends Table {
KEY author_id (author_id),
KEY initiator (initiator)";
}
/**
* Fixes the datetime columns to accept null.
*

View File

@ -27,10 +27,15 @@ class Membership_Status extends Enum {
const __default = 'pending'; // phpcs:ignore
const PENDING = 'pending';
const ACTIVE = 'active';
const TRIALING = 'trialing';
const EXPIRED = 'expired';
const ON_HOLD = 'on-hold';
const CANCELLED = 'cancelled';
/**

View File

@ -112,6 +112,7 @@ final class Memberships_Table extends Table {
KEY status (status),
KEY disabled (disabled)";
}
/**
* Fixes the datetime columns to accept null.
*

View File

@ -27,11 +27,17 @@ class Payment_Status extends Enum {
const __default = 'pending'; // phpcs:ignore
const PENDING = 'pending';
const COMPLETED = 'completed';
const REFUND = 'refunded';
const PARTIAL_REFUND = 'partially-refunded';
const PARTIAL = 'partially-paid';
const FAILED = 'failed';
const CANCELLED = 'cancelled';
/**

View File

@ -155,6 +155,7 @@ final class Payments_Table extends Table {
// Return success/fail
return $this->is_success($result);
}
/**
* Fixes the datetime columns to accept null.
*

View File

@ -88,6 +88,7 @@ final class Posts_Table extends Table {
status varchar(100) NOT NULL default 'draft',
PRIMARY KEY (id)";
}
/**
* Fixes the datetime columns to accept null.
*

View File

@ -27,7 +27,9 @@ class Product_Type extends Enum {
const __default = 'plan'; // phpcs:ignore
const PLAN = 'plan';
const PACKAGE = 'package';
const SERVICE = 'service';
/**

View File

@ -154,6 +154,7 @@ final class Products_Table extends Table {
// Return success/fail
return $this->is_success($result);
}
/**
* Fixes the datetime columns to accept null.
*

View File

@ -27,10 +27,15 @@ class Site_Type extends Enum {
const __default = 'default'; // phpcs:ignore
const REGULAR = 'default';
const SITE_TEMPLATE = 'site_template';
const CUSTOMER_OWNED = 'customer_owned';
const PENDING = 'pending';
const EXTERNAL = 'external';
const MAIN = 'main';
/**

View File

@ -94,6 +94,7 @@ final class Webhooks_Table extends Table {
// phpcs:enable
}
/**
* Fixes the datetime columns to accept null.
*