Skip to content
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

[Documentation] Squiz: Scope Closing Brace #353

Merged
59 changes: 59 additions & 0 deletions src/Standards/Squiz/Docs/WhiteSpace/ScopeClosingBraceStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<documentation title="Scope Closing Brace">
<standard>
<![CDATA[
Indentation of a closing brace must match the indentation of the line containing the opening brace.
]]>
</standard>
<code_comparison>
<code title="Valid: Closing brace aligned with line containing opening brace.">
<![CDATA[
function foo()
{
<em>}</em>

if (!class_exists('Foo')) {
class Foo {
<em>}</em>
<em>}</em>

<?php if ($something) { ?>
<span>some output</span>
<em><?php }</em> ?>
]]>
</code>
<code title="Invalid: Closing brace misaligned with line containing opening brace.">
<![CDATA[
function foo()
{
<em> }</em>

if (!class_exists('Foo')) {
class Foo {
<em>}</em>
<em> }</em>

<?php if ($something) { ?>
<span>some output</span>
<em> <?php }</em> ?>
]]>
</code>
</code_comparison>
<standard>
<![CDATA[
Closing brace must be on a line by itself.
]]>
</standard>
<code_comparison>
<code title="Valid: Close brace on its own line.">
<![CDATA[
enum Foo {
<em>}</em>
]]>
</code>
<code title="Invalid: Close brace on a line containing other code.">
<![CDATA[
enum Foo {<em>}</em>
]]>
</code>
</code_comparison>
</documentation>
Loading