#62033 closed enhancement (wontfix)
Fix missing Yoda Conditions
| Reported by: | debarghyabanerjee | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | coding-standards |
Description
I noticed that Yoda conditions are not consistently used. This oversight appears in several areas of the codebase. It is important to address these inconsistencies to align with the coding standards and best practices.
I am mentioning the files, where I have encountered these missing Yoda conditions, however there can be more instances as well.
wp-admin/includes/misc.php
wp-admin/includes/upgrade.php
wp-admin/menu-header.php
wp-admin/update-core.php
wp-includes/blocks.php
wp-includes/class-wp-query.php
wp-includes/class-wpdb.php
wp-includes/formatting.php
wp-includes/functions.php
wp-includes/meta.php
wp-includes/ms-load.php
wp-includes/rest-api.php
wp-includes/template.php
wp-login.php
Change History (3)
This ticket was mentioned in PR #7325 on WordPress/wordpress-develop by @debarghyabanerjee.
2 years ago
#1
- Keywords has-patch added
#2
@
2 years ago
- Milestone Awaiting Review
- Resolution → wontfix
- Status new → closed
@debarghyabanerjee While I understand and appreciate your wish to improve WordPress, in none of the cases you flagged Yoda conditions are needed as none of these conditions do a comparison with a variable.
The patch would only decrease code readability for no benefit.
Also see: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#yoda-conditions
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac Ticket: Core-62033
## Problem Statement
## Solution
## Changes Made
## Impact