PHP Classes

File: zray/vendor/PHP_CodeSniffer-2.2.0/CodeSniffer/Standards/Squiz/Docs/Classes/SelfMemberReferenceStandard.xml

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

Contents

Class file image Download
<documentation title="Self Member Reference">
    <standard>
    <![CDATA[
    The self keyword should be used instead of the current class name, should be lowercase, and should not have spaces before or after it.
    ]]>
    </standard>
    <code_comparison>
        <code title="Valid: Lowercase self used.">
        <![CDATA[
<em>self</em>::foo();
]]>
        </code>
        <code title="Invalid: Uppercase self used.">
        <![CDATA[
<em>SELF</em>::foo();
]]>
        </code>
    </code_comparison>
    <code_comparison>
        <code title="Valid: Correct spacing used.">
        <![CDATA[
self<em></em>::<em></em>foo();
]]>
        </code>
        <code title="Invalid: Incorrect spacing used.">
        <![CDATA[
self<em> </em>::<em> </em>foo();
]]>
        </code>
    </code_comparison>
    <code_comparison>
        <code title="Valid: Self used as reference.">
        <![CDATA[
class Foo
{
    public static function bar()
    {
    }

    public static function baz()
    {
        <em>self</em>::bar();
    }
}
]]>
        </code>
        <code title="Invalid: Local class name used as reference.">
        <![CDATA[
class <em>Foo</em>
{
    public static function bar()
    {
    }

    public static function baz()
    {
        <em>Foo</em>::bar();
    }
}
]]>
        </code>
    </code_comparison>
</documentation>
For more information send a message to info at phpclasses dot org.