-
-
Notifications
You must be signed in to change notification settings - Fork 83
[Documentation] Squiz: Superfluous Whitespace #352
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
jrfnl
merged 5 commits into
PHPCSStandards:master
from
jaymcp:docs/Squiz.WhiteSpace.SuperfluousWhitespace
Feb 27, 2024
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1238c8a
Docs: add documentation for Squiz.WhiteSpace.SuperfluousWhitespace
jaymcp aa088bd
Docs: improve documentation for Squiz.WhiteSpace.SuperfluousWhitespace
jaymcp fe18bcb
Docs: fix typo in Squiz.WhiteSpace.SuperfluousWhitespace code example
jaymcp a584db2
Docs: rewrite incorrect code example for Squiz.WhiteSpace.Superfluous…
jaymcp c593d61
Squiz/SuperfluousWhitespace: tiny tweak
jrfnl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
99 changes: 99 additions & 0 deletions
99
src/Standards/Squiz/Docs/WhiteSpace/SuperfluousWhitespaceStandard.xml
This file contains hidden or 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,99 @@ | ||
<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 linechar'; | ||
]]> | ||
</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 more than one consecutive blank newline 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 at the end of a file. | ||
A single final newline is allowed. A closing PHP tag is optional and ignored. | ||
jrfnl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: A single newline appears after the last content in the file."> | ||
<![CDATA[ | ||
function myFunction() | ||
{ | ||
echo 'closing curly brace, 1 newline'; | ||
echo 'optional closing PHP tag'; | ||
echo 'then EOF'; | ||
}<em> | ||
</em> | ||
?> | ||
]]> | ||
</code> | ||
<code title="Invalid: Multiple newlines appear after the last content in the file."> | ||
<![CDATA[ | ||
function myFunction() | ||
{ | ||
echo 'closing curly brace, 2 newlines'; | ||
echo 'optional closing PHP tag'; | ||
echo 'then EOF'; | ||
}<em> | ||
|
||
</em> | ||
?> | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.