#48455 closed defect (bug) (fixed)
Missing Yoda condition
Reported by: | 1naveengiri | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.4 | Priority: | normal |
Severity: | normal | Version: | 5.3 |
Component: | Administration | Keywords: | has-patch needs-testing |
Focuses: | coding-standards | Cc: |
Description
Yoda condition is missing at line
https://github.com/WordPress/WordPress/blob/master/wp-admin/user-new.php#L66
Thanks
Attachments (3)
Change History (17)
#2
@
5 years ago
@1naveengiri Do we really need yoda conditions since it does not provide much advantage. But do take aways readiablity.
#3
follow-up:
↓ 4
@
5 years ago
https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#yoda-conditions
Based on WP coding standards, Yes we need.
#4
in reply to:
↑ 3
;
follow-up:
↓ 5
@
5 years ago
Replying to 1naveengiri:
https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#yoda-conditions
Based on WP coding standards, Yes we need.
ohh.. Okay
Thanks
#5
in reply to:
↑ 4
;
follow-up:
↓ 7
@
5 years ago
Replying to alishankhan:
Replying to 1naveengiri:
https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#yoda-conditions
Based on WP coding standards, Yes we need.
ohh.. Okay
Thanks
Is anyone working on this ticket?
#7
in reply to:
↑ 5
@
5 years ago
Replying to Marcio Zebedeu:
Replying to alishankhan:
Replying to 1naveengiri:
https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#yoda-conditions
Based on WP coding standards, Yes we need.
ohh.. Okay
Thanks
Is anyone working on this ticket?
yep I was, but no problem.Cheers!!
#9
in reply to:
↑ 8
@
5 years ago
Replying to alishankhan:
@marcio-zebedeu
Please rebase your diff.
okay no need,
48455.1.patch is already rebased.
#10
@
5 years ago
- Component changed from General to Administration
- Milestone changed from Awaiting Review to 5.4
#11
@
5 years ago
@alishankhan sorry if I'm hijacking this ticket, I wanted to help out a bit with 5.4 and this was a good candidate :)
Refreshed patch, caught a couple more cases where this was happening. Just needs some testing and another set of eyes to verify that the switched variables aren't changing the logic.
Note that the patch was made with git diff --no-ext-diff master > 48455.2.patch
. If a different command is needed for SVN compatibility let me know and I can refresh.
https://github.com/WordPress/WordPress/blob/master/wp-admin/update-core.php#L167
https://github.com/WordPress/WordPress/blob/master/wp-admin/update-core.php#L255
https://github.com/WordPress/WordPress/blob/master/wp-admin/update-core.php#L691
https://github.com/WordPress/WordPress/blob/master/wp-admin/update-core.php#L742
https://github.com/WordPress/WordPress/blob/master/wp-admin/post.php#L304
https://github.com/WordPress/WordPress/blob/master/wp-admin/options.php#L336
https://github.com/WordPress/WordPress/blob/master/wp-admin/ms-delete-site.php#L45
https://github.com/WordPress/WordPress/blob/master/wp-admin/media.php#L72
https://github.com/WordPress/WordPress/blob/master/wp-admin/media-upload.php#L36
https://github.com/WordPress/WordPress/blob/master/wp-admin/media-upload.php#L84
https://github.com/WordPress/WordPress/blob/master/wp-admin/install.php#L389