File tree Expand file tree Collapse file tree
WordPress/Docs/CodeAnalysis Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 >
66 <standard >
77 <![CDATA[
8- Variables should not be assigned in the condition of a ternary expression.
9- The condition must be in parentheses to be checked; ternaries lacking parentheses around the condition are skipped.
8+ Variables should not be assigned in the condition of a ternary expression. This is likely a mistake, as more often than not a comparison was intended.
9+
10+ Note: This sniff can only detect assignments when the ternary condition is wrapped in parentheses.
1011 ]]>
1112 </standard >
1213 <code_comparison >
13- <code title =" Valid: Conditional statement in parentheses and does not include variable assignment ." >
14+ <code title =" Valid: Comparison operator used in ternary condition ." >
1415 <![CDATA[
1516$mode = ( $a <em>===</em> 'a' ) ? 'b' : 'c';
1617 ]]>
1718 </code >
18- <code title =" Invalid: Conditional statement in parentheses but includes variable assignment instead of comparison ." >
19+ <code title =" Invalid: Assignment in parenthesized ternary condition ." >
1920 <![CDATA[
2021$mode = ( $a <em>=</em> 'a' ) ? 'b' : 'c';
2122 ]]>
You can’t perform that action at this time.
0 commit comments