PHP Classes

File: zray/vendor/PHP_CodeSniffer-2.2.0/CodeSniffer/Standards/PSR2/Docs/Classes/PropertyDeclarationStandard.xml

Recommend this page to a friend!
  Classes of Simo  >  CodeIgniter Plugin for Z-Ray  >  zray/vendor/PHP_CodeSniffer-2.2.0/CodeSniffer/Standards/PSR2/Docs/Classes/PropertyDeclarationStandard.xml  >  Download  
File: zray/vendor/PHP_CodeSniffer-2.2.0/CodeSniffer/Standards/PSR2/Docs/Classes/PropertyDeclarationStandard.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,422 bytes
 

Contents

Class file image Download
<documentation title="Property Declarations">
    <standard>
    <![CDATA[
    Property names should not be prefixed with an underscore to indicate visibility.  Visibility should be used to declare properties rather than the var keyword.  Only one property should be declared within a statement.
    ]]>
    </standard>
    <code_comparison>
        <code title="Valid: Correct property naming.">
        <![CDATA[
class Foo
{
    private $<em>bar</em>;
}
        ]]>
        </code>
        <code title="Invalid: An underscore prefix used to indicate visibility.">
        <![CDATA[
class Foo
{
    private $<em>_bar</em>;
}
        ]]>
        </code>
    </code_comparison>
    <code_comparison>
        <code title="Valid: Visibility of property declared.">
        <![CDATA[
class Foo
{
    <em>private</em> $bar;
}
        ]]>
        </code>
        <code title="Invalid: Var keyword used to declare property.">
        <![CDATA[
class Foo
{
    <em>var</em> $bar;
}
        ]]>
        </code>
    </code_comparison>
    <code_comparison>
        <code title="Valid: One property declared per statement.">
        <![CDATA[
class Foo
{
    private $bar;
    private $baz;
}
        ]]>
        </code>
        <code title="Invalid: Multiple properties declared in one statement.">
        <![CDATA[
class Foo
{
    private <em>$bar, $baz</em>;
}
        ]]>
        </code>
    </code_comparison>
</documentation>
For more information send a message to info at phpclasses dot org.