Skip to content

[Doc] Cover all errors of PEAR ClassDeclaration #856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 58 additions & 4 deletions src/Standards/PEAR/Docs/Classes/ClassDeclarationStandard.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<documentation title="Class Declarations">
<documentation title="Class Declaration">
<standard>
<![CDATA[
The opening brace of a class must be on the line after the definition by itself.
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>
Expand All @@ -12,10 +12,64 @@ class Foo
}
]]>
</code>
<code title="Invalid: Opening brace on same line as declaration.">
<code title="Invalid: Opening brace on incorrect line.">
<![CDATA[
class Foo <em>{</em>
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>
Expand Down