PHP Classes

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

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   Download Installed Plugin   vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowShortTernaryStandard.xml   Download  
File: vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowShortTernaryStandard.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: 908 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 Short Ternary" > <standard> <![CDATA[ Using short ternaries is not allowed. While short ternaries are useful when used correctly, the principle of them is often misunderstood and they are more often than not used incorrectly, leading to hard to debug issues and/or PHP warnings/notices. ]]> </standard> <code_comparison> <code title="Valid: Full ternary."> <![CDATA[ echo !empty($a) <em>?</em> $a <em>:</em> 'default'; ]]> </code> <code title="Invalid: Short ternary."> <![CDATA[ echo !empty($a) <em>?:</em> 'default'; echo $a <em>? :</em> 'default'; ]]> </code> </code_comparison> </documentation>