More yoda conditions

This commit is contained in:
David Stone
2025-02-09 12:30:02 -07:00
parent d9122a410d
commit 0a4c81c105
97 changed files with 323 additions and 289 deletions

View File

@ -54,7 +54,7 @@ class Customer_User_Role_Limits {
$screen = get_current_screen();
if ( ! $screen || $screen->id !== 'user') {
if ( ! $screen || 'user' !== $screen->id) {
return;
}

View File

@ -112,7 +112,7 @@ class Post_Type_Limits {
*/
public function limit_restoring(): void {
if (isset($_REQUEST['action']) && $_REQUEST['action'] === 'untrash') {
if (isset($_REQUEST['action']) && 'untrash' === $_REQUEST['action']) {
$this->limit_posts();
}
}
@ -170,7 +170,7 @@ class Post_Type_Limits {
}
if (isset($data['post_status']) && $data['post_status'] !== 'publish') {
if (isset($data['post_status']) && 'publish' !== $data['post_status']) {
return $data;
}
@ -208,10 +208,10 @@ class Post_Type_Limits {
$quota = wu_get_current_site()->get_limitations()->post_types->attachment->number;
// This bit is for the flash uploader
if ($file['type'] === 'application/octet-stream' && isset($file['tmp_name'])) {
if ('application/octet-stream' === $file['type'] && isset($file['tmp_name'])) {
$file_size = getimagesize($file['tmp_name']);
if (isset($file_size['error']) && $file_size['error'] !== 0) {
if (isset($file_size['error']) && 0 !== $file_size['error']) {
$file['error'] = "Unexpected Error: {$file_size['error']}";
return $file;

View File

@ -330,7 +330,7 @@ class Theme_Limits {
*/
protected function get_forced_theme_stylesheet() {
if ($this->forced_theme_stylesheet === null) {
if (null === $this->forced_theme_stylesheet) {
$this->forced_theme_stylesheet = wu_get_current_site()->get_limitations()->themes->get_forced_active_theme();
}
@ -346,7 +346,7 @@ class Theme_Limits {
*/
protected function get_forced_theme_template() {
if ($this->forced_theme_template === null) {
if (null === $this->forced_theme_template) {
$stylesheet = $this->get_forced_theme_stylesheet();
$this->forced_theme_template = $stylesheet ? wp_get_theme($stylesheet)->get_template() : false;