PHP 8.2.31
Preview: ClassDeclarationStandard.xml Size: 1.73 KB
/opt/cpanel/ea-wappspector/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Docs/Classes/ClassDeclarationStandard.xml

<documentation title="Class Declaration">
    <standard>
    <![CDATA[
    The opening brace of an OO structure must be on the line directly after the OO signature. The opening brace must be on a line by itself.
    ]]>
    </standard>
    <code_comparison>
        <code title="Valid: Opening brace on the correct line.">
        <![CDATA[
class Foo
<em>{</em>
}
        ]]>
        </code>
        <code title="Invalid: Opening brace on incorrect line.">
        <![CDATA[
class BraceOnSignatureLine <em>{</em>
}

class BlankLineBetween
<em></em>
{
}
        ]]>
        </code>
    </code_comparison>
    <code_comparison>
        <code title="Valid: Opening brace is on a line by itself.">
        <![CDATA[
class Foo
<em>{</em>
}
        ]]>
        </code>
        <code title="Invalid: Opening brace is not on a line by itself.">
        <![CDATA[
class Foo
{<em> public function __construct() {}</em>
}
        ]]>
        </code>
    </code_comparison>
    <standard>
    <![CDATA[
    The opening brace must be indented to the same depth as the OO structure's declaration.
    ]]>
    </standard>
    <code_comparison>
        <code title="Valid: Opening brace indentation depth matches the OO structure signature's depth.">
        <![CDATA[
if (!class_exists('IndentedFourSpaces')) {
    abstract class IndentedFourSpaces
    <em>{</em>
    }
}
        
class NotIndented
<em>{</em>
}
        ]]>
        </code>
        <code title="Invalid: Opening brace indentation depth does not match the OO structure signature's depth.">
        <![CDATA[
if (!class_exists('IndentedFourSpaces')) {
    abstract class IndentedFourSpaces
<em>{</em>
}
}
        
class NotIndented
    <em>{</em>
    }
        ]]>
        </code>
    </code_comparison>
</documentation>

Directory Contents

Dirs: 0 × Files: 1

Name Size Perms Modified Actions
1.73 KB lrw-r--r-- 2025-11-04 16:30:35
Edit Download

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