Make WordPress Core

Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#62164 closed defect (bug) (wontfix)

Fix PHPCS "Yoda Condition checks" of WordPress Core file media.php.

Reported by: deepakrohilla's profile deepakrohilla Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: Cc:

Description

in wp-includes/media.php file Fix PHPCS "Yoda Condition checks" needs to be fixed

In this ticket I am adding patch to fix PHPCS "Yoda Condition checks" errors in media.php.

Change History (7)

#2 @debarghyabanerjee
9 months ago

Hi @deepakrohilla, Thanks for reporting this, but I don't think this is needed/required as it doesn't involve a comparison with a variable, rather with the count.

Please also check: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#yoda-conditions

@debarghyabanerjee commented on PR #7491:


9 months ago
#3

This patch should not be applied, as it doesn't involve comparison with a variable.

#4 @debarghyabanerjee
9 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

@pratiklondhe commented on PR #7491:


9 months ago
#5

Yes, makes sense to not merge this, as purpose of using YODA condition is to throw error if we accidentally use = (assignment) instead of == (comparison ),

  • here the order doesn't matter as we can not assign any value to a function's return value anyways ( it will throw error )

@mukesh27 commented on PR #7491:


9 months ago
#6

The ticket was closed. Feel free to reopen.

#7 @desrosj
9 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.