PHP Classes

File: vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/RequireExplicitBooleanOperatorPrecedenceStandard.xml

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   Download Installed Plugin   vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/RequireExplicitBooleanOperatorPrecedenceStandard.xml   Download  
File: vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/RequireExplicitBooleanOperatorPrecedenceStandard.xml
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Download Installed Plugin
Download a WordPress plugin as a ZIP archive
Author: By
Last change:
Date: Yesterday
Size: 1,079 bytes
 

Contents

Class file image Download
<documentation title="Require Explicit Boolean Operator Precedence" > <standard> <![CDATA[ Forbids mixing different binary boolean operators (&&, ||, and, or, xor) within a single expression without making precedence clear using parentheses. ]]> </standard> <code_comparison> <code title="Valid: Making precedence clear with parentheses."> <![CDATA[ $one = false; $two = false; $three = true; $result = <em>($one && $two) || $three</em>; $result2 = <em>$one && ($two || $three)</em>; $result3 = <em>($one && !$two) xor $three</em>; $result4 = <em>$one && (!$two xor $three)</em>; if ( <em>($result && !$result3) || (!$result && $result3)</em> ) {} ]]> </code> <code title="Invalid: Not using parentheses."> <![CDATA[ $one = false; $two = false; $three = true; $result = <em>$one && $two || $three</em>; $result3 = <em>$one && !$two xor $three</em>; if ( <em>$result && !$result3 || !$result && $result3</em> ) {} ]]> </code> </code_comparison> </documentation>