forked from squizlabs/PHP_CodeSniffer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Documentation] Squiz: Superfluous Whitespace (squizlabs#352)
* Docs: add documentation for Squiz.WhiteSpace.SuperfluousWhitespace * Docs: improve documentation for Squiz.WhiteSpace.SuperfluousWhitespace - Add code comparison for a missed error code (EOF) - Fixup CDATA indentation - Clarify wording in code examples * Docs: fix typo in Squiz.WhiteSpace.SuperfluousWhitespace code example * Docs: rewrite incorrect code example for Squiz.WhiteSpace.SuperfluousWhitespace.EndFile * Squiz/SuperfluousWhitespace: tiny tweak
- Loading branch information
Showing
1 changed file
with
98 additions
and
0 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
src/Standards/Squiz/Docs/WhiteSpace/SuperfluousWhitespaceStandard.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<documentation title="Superfluous Whitespace"> | ||
<standard> | ||
<![CDATA[ | ||
There should be no superfluous whitespace at the start of a file. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: No whitespace preceding first content in file."> | ||
<![CDATA[<?php | ||
echo 'opening PHP tag at start of file'; | ||
]]> | ||
</code> | ||
<code title="Invalid: Whitespace used before content in file."> | ||
<![CDATA[ | ||
<em> </em> | ||
<?php | ||
echo 'whitespace before opening PHP tag'; | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<standard> | ||
<![CDATA[ | ||
There should be no trailing whitespace at the end of lines. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: No whitespace found at end of line."> | ||
<![CDATA[ | ||
echo 'semicolon followed by new line char'; | ||
]]> | ||
</code> | ||
<code title="Invalid: Whitespace found at end of line."> | ||
<![CDATA[ | ||
echo 'trailing spaces after semicolon';<em> </em> | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<standard> | ||
<![CDATA[ | ||
There should be no consecutive blank lines in functions. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: Functions do not contain multiple empty lines in a row."> | ||
<![CDATA[ | ||
function myFunction() | ||
{ | ||
echo 'code here'; | ||
echo 'code here'; | ||
} | ||
]]> | ||
</code> | ||
<code title="Invalid: Functions contain multiple empty lines in a row."> | ||
<![CDATA[ | ||
function myFunction() | ||
{ | ||
echo 'code here'; | ||
<em> | ||
</em>echo 'code here'; | ||
} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<standard> | ||
<![CDATA[ | ||
There should be no superfluous whitespace after the final closing PHP tag in a file. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: A single new line appears after the last content in the file."> | ||
<![CDATA[ | ||
function myFunction() | ||
{ | ||
echo 'Closing PHP tag, then'; | ||
echo 'Single new line char, then EOF'; | ||
} | ||
?><em> | ||
</em> | ||
]]> | ||
</code> | ||
<code title="Invalid: Multiple new lines appear after the last content in the file."> | ||
<![CDATA[ | ||
function myFunction() | ||
{ | ||
echo 'Closing PHP tag, then'; | ||
echo 'Multiple new line chars, then EOF'; | ||
} | ||
?><em> | ||
</em> | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |