PHP Classes

File: zray/vendor/PHP_CodeSniffer-2.2.0/CodeSniffer/Standards/Generic/Docs/Formatting/MultipleStatementAlignmentStandard.xml

Recommend this page to a friend!
  Classes of Simo  >  CodeIgniter Plugin for Z-Ray  >  zray/vendor/PHP_CodeSniffer-2.2.0/CodeSniffer/Standards/Generic/Docs/Formatting/MultipleStatementAlignmentStandard.xml  >  Download  
File: zray/vendor/PHP_CodeSniffer-2.2.0/CodeSniffer/Standards/Generic/Docs/Formatting/MultipleStatementAlignmentStandard.xml
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: CodeIgniter Plugin for Z-Ray
Show CodeIgniter application information in Z-Ray
Author: By
Last change:
Date: 3 months ago
Size: 1,741 bytes
 

Contents

Class file image Download
<documentation title="Aligning Blocks of Assignments">
    <standard>
    <![CDATA[
      There should be one space on either side of an equals sign used to assign a value to a variable. In the case of a block of related assignments, more space may be inserted to promote readability.
    ]]>
    </standard>
    <code_comparison>
        <code title="Equals signs aligned">
        <![CDATA[
$shortVar        <em>=</em> (1 + 2);
$veryLongVarName <em>=</em> 'string';
$var             <em>=</em> foo($bar, $baz, $quux);
        ]]>
        </code>
        <code title="Not aligned; harder to read">
        <![CDATA[
$shortVar <em>=</em> (1 + 2);
$veryLongVarName <em>=</em> 'string';
$var <em>=</em> foo($bar, $baz, $quux);
        ]]>
        </code>
    </code_comparison>
    <standard>
    <![CDATA[
      When using plus-equals, minus-equals etc. still ensure the equals signs are aligned to one space after the longest variable name.
    ]]>
    </standard>
    <code_comparison>
        <code title="Equals signs aligned; only one space after longest var name">
        <![CDATA[
$shortVar       <em>+= </em>1;
$veryLongVarName<em> = </em>1;
        ]]>
        </code>
        <code title="Two spaces after longest var name">
        <![CDATA[
$shortVar       <em> += </em>1;
$veryLongVarName<em>  = </em>1;
        ]]>
        </code>
    </code_comparison>
    <code_comparison>
        <code title="Equals signs aligned">
        <![CDATA[
$shortVar       <em>  = </em>1;
$veryLongVarName<em> -= </em>1;
        ]]>
        </code>
        <code title="Equals signs not aligned">
        <![CDATA[
$shortVar       <em> = </em>1;
$veryLongVarName<em> -= </em>1;
        ]]>
        </code>
    </code_comparison>
</documentation>
For more information send a message to info at phpclasses dot org.