PHP Classes

File: vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Docs/ControlStructures/BooleanOperatorPlacementStandard.xml

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   Download Installed Plugin   vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Docs/ControlStructures/BooleanOperatorPlacementStandard.xml   Download  
File: vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Docs/ControlStructures/BooleanOperatorPlacementStandard.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: 2 days ago
Size: 1,362 bytes
 

Contents

Class file image Download
<documentation title="Boolean Operator Placement"> <standard> <![CDATA[ Boolean operators between conditions in control structures must always be at the beginning or at the end of the line, not a mix of both. This rule applies to if/else conditions, while loops and switch/match statements. ]]> </standard> <code_comparison> <code title="Valid: Boolean operator between conditions consistently at the beginning of the line."> <![CDATA[ if ( $expr1 && $expr2 && ($expr3 || $expr4) && $expr5 ) { // if body. } ]]> </code> <code title="Invalid: Mix of boolean operators at the beginning and the end of the line."> <![CDATA[ if ( $expr1 && ($expr2 || $expr3) && $expr4 ) { // if body. } ]]> </code> </code_comparison> <code_comparison> <code title="Valid: Boolean operator between conditions consistently at the end of the line."> <![CDATA[ if ( $expr1 || ($expr2 || $expr3) && $expr4 ) { // if body. } ]]> </code> <code title="Invalid: Mix of boolean operators at the beginning and the end of the line."> <![CDATA[ match ( $expr1 && $expr2 || $expr3 ) { // structure body. }; ]]> </code> </code_comparison> </documentation>