PHP Classes

File: vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowLogicalAndOrStandard.xml

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   Download Installed Plugin   vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowLogicalAndOrStandard.xml   Download  
File: vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowLogicalAndOrStandard.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,033 bytes
 

Contents

Class file image Download
<?xml version="1.0"?> <documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" title="Disallow Logical And Or" > <standard> <![CDATA[ Using the logical "and" and "or" operators is not allowed. The logical "and" and "or" operators have a significantly lower operator precedence than their boolean "&&" and "||" counter-parts, which often leads to unexpected bugs. The boolean "&&" and "||" operators are nearly always the better choice. ]]> </standard> <code_comparison> <code title="Valid: Using boolean operators."> <![CDATA[ if (isset($var) <em>&&</em> $var > 10) {} if (empty($var) <em>||</em> $var < 0) {} ]]> </code> <code title="Invalid: Using logical operators."> <![CDATA[ if (isset($var) <em>and</em> $var > 10) {} if (empty($var) <em>or</em> $var < 0) {} ]]> </code> </code_comparison> </documentation>