WordPress-Coding-Standards icon indicating copy to clipboard operation
WordPress-Coding-Standards copied to clipboard

Handbook: Check that ternaries test for `true`

Open jrfnl opened this issue 9 years ago • 0 comments

Ternary operators are fine, but always have them test if the statement is true, not false. Otherwise, it just gets confusing. (An exception would be using ! empty(), as testing for false here is generally more intuitive.)

ref: https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#ternary-operator

jrfnl avatar Jul 28 '16 17:07 jrfnl