diff --git a/src/ChangeLog/ChangeLog.php b/src/ChangeLog/ChangeLog.php index 574c2db..0ef0c0a 100644 --- a/src/ChangeLog/ChangeLog.php +++ b/src/ChangeLog/ChangeLog.php @@ -181,11 +181,6 @@ class ChangeLog protected function db(): \wpdb { - if ($this->db === null) { - global $wpdb; - $this->db = $wpdb; - } - - return $this->db; + return $this->db ?? $GLOBALS['wpdb']; } } diff --git a/src/Integrations/Divi/Pages/DiviReplaceTextAbility.php b/src/Integrations/Divi/Pages/DiviReplaceTextAbility.php index e37b66f..f7189da 100644 --- a/src/Integrations/Divi/Pages/DiviReplaceTextAbility.php +++ b/src/Integrations/Divi/Pages/DiviReplaceTextAbility.php @@ -490,11 +490,6 @@ final class DiviReplaceTextAbility implements Ability private function db(): \wpdb { - if ($this->db === null) { - global $wpdb; - $this->db = $wpdb; - } - - return $this->db; + return $this->db ?? $GLOBALS['wpdb']; } } diff --git a/src/Integrations/WordPress/Status/PostCloner.php b/src/Integrations/WordPress/Status/PostCloner.php index fdfa993..ed4a991 100644 --- a/src/Integrations/WordPress/Status/PostCloner.php +++ b/src/Integrations/WordPress/Status/PostCloner.php @@ -362,11 +362,6 @@ class PostCloner private function db(): \wpdb { - if ($this->db === null) { - global $wpdb; - $this->db = $wpdb; - } - - return $this->db; + return $this->db ?? $GLOBALS['wpdb']; } }