PHP 8.2.31
Preview: SelfMemberReferenceStandard.xml Size: 1.70 KB
/opt/cpanel/ea-wappspector/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Docs/Classes/SelfMemberReferenceStandard.xml

<documentation title="Self Member Reference">
    <standard>
    <![CDATA[
    The self keyword must be lowercase.
    ]]>
    </standard>
    <code_comparison>
        <code title="Valid: Lowercase self used.">
        <![CDATA[
class Bar {
    public function baz() {
        <em>self</em>::foo();
    }
}
        ]]>
        </code>
        <code title="Invalid: Uppercase self used.">
        <![CDATA[
class Bar {
    public function baz() {
        <em>SELF</em>::foo();
    }
}
        ]]>
        </code>
    </code_comparison>
    <standard>
    <![CDATA[
    There must be no spaces before or after the double colon operator.
    ]]>
    </standard>
    <code_comparison>
        <code title="Valid: No spaces around the double colon operator.">
        <![CDATA[
class Bar {
    public function baz() {
        self<em></em>::<em></em>foo();
    }
}
        ]]>
        </code>
        <code title="Invalid: Spaces around double colon operator.">
        <![CDATA[
class Bar {
    public function baz() {
        self<em> </em>::<em> </em>foo();
    }
}
        ]]>
        </code>
    </code_comparison>
    <standard>
    <![CDATA[
    The self keyword must be used instead of the current class name.
    ]]>
    </standard>
    <code_comparison>
        <code title="Valid: Self used as reference.">
        <![CDATA[
class Foo {
    public function bar() {}

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

    public function baz() {
        <em>Foo</em>::bar();
    }
}
        ]]>
        </code>
    </code_comparison>
</documentation>

Directory Contents

Dirs: 0 × Files: 4

Name Size Perms Modified Actions
1.05 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
624 B lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.70 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download
1.00 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).