#62033 closed enhancement (wontfix)
Fix missing Yoda Conditions
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | General | Keywords: | has-patch |
| Focuses: | coding-standards | Cc: |
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.
19 months ago
#1
- Keywords has-patch added
#2
@
19 months ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to 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
Trac Ticket: Core-62033
## Problem Statement
## Solution
## Changes Made
## Impact