PHP Classes

File: vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/ArrayKeySpacingRestrictionsStandard.xml

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   Download Installed Plugin   vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/ArrayKeySpacingRestrictionsStandard.xml   Download  
File: vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/ArrayKeySpacingRestrictionsStandard.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,244 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="Array Key Spacing Restrictions" > <standard> <![CDATA[ When referring to array items, only include a space around the index if it is a variable or the key is concatenated. ]]> </standard> <code_comparison> <code title="Valid: Correct spacing around the index keys"> <![CDATA[ $post = $posts<em>[ </em>$post_id<em> ]</em>; $post_title = $post<em>[ </em>'concatenated' . $title<em> ]</em>; $post = $posts<em>[ </em>HOME_PAGE<em> ]</em>; $post = $posts<em>[</em>123<em>]</em>; $post_title = $post<em>[</em>'post_title'<em>]</em>; ]]> </code> <code title="Invalid: Incorrect spacing around the index keys"> <![CDATA[ $post = $posts<em>[</em>$post_id<em>]</em>; $post_title = $post<em>[</em>'concatenated' . $title<em> ]</em>; $post = $posts<em>[</em>HOME_PAGE<em>]</em>; $post = $posts<em>[ </em>123<em> ]</em>; $post_title = $post<em>[ </em>'post_title'<em> ]</em>; ]]> </code> </code_comparison> </documentation>