WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#40080 closed defect (bug) (invalid)

Yoda condition is missing in some files

Reported by: viralsampat Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

I have checked some core files in that inside some files I found the 'if' conditional statement is not obeying the rule of 'Yoda' Condition.

As per this link https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#yoda-conditions . Every 'if' Statement should follow 'Yoda Condition' rule.

Below is the file URL:-
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/post.php#L2434

Change History (1)

#1 @SergeyBiryukov
5 years ago

  • Component changed from General to Posts, Post Types
  • Focuses accessibility administration removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hi @viralsampat, welcome to WordPress Trac! Thanks for the ticket.

WordPress generally discourages code refactoring just for the sake of formatting cleanup. Coding style fixes should be a result of more substantial changes: https://make.wordpress.org/core/handbook/contribute/code-refactoring/.

Note: See TracTickets for help on using tickets.