-
-
Notifications
You must be signed in to change notification settings - Fork 77
[Documentation] PSR12 - Control Structure Spacing #182
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 21 commits into
PHPCSStandards:master
from
dingo-d:documentation/PSR12-control-structures-control-structure-spacing
Jan 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5a0186f
Add the documentation for the PSR12 Control Structure Spacing sniff
dingo-d f4fabf1
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d 62cd376
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d baf28e9
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d 5961ed8
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d e2f79ab
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d 4ac58b1
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d c14c5dd
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d 8041c8b
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d a57752b
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d 0b63cb0
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d 1bf2c27
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d f6ec02b
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d 383618b
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d cdeef4d
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d c62e10f
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d a1795c1
Improve readability of the documentation
dingo-d b38b4b7
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d f593a53
Fix suggestions from the PR
dingo-d 6a22d05
Update the standard description for single line control structures
dingo-d 77366bb
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d 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
114 changes: 114 additions & 0 deletions
114
src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpacingStandard.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,114 @@ | ||
<documentation title="Control Structure Spacing"> | ||
<standard> | ||
<![CDATA[ | ||
Control structures MUST have correct spacing. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: No space after the opening parenthesis."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
if ($expr) { | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
]]> | ||
</code> | ||
<code title="Invalid: Space after the opening parenthesis."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
if (<em> </em>$expr) { | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<code_comparison> | ||
<code title="Valid: No space before the closing parenthesis."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
if ($expr) { | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
]]> | ||
</code> | ||
<code title="Invalid: Space before the closing parenthesis."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
if ($expr<em> </em>) { | ||
} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<code_comparison> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<code title="Valid: Each line in a multi-line control structure indented at least once. Default indentation is 4 spaces."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
while ( | ||
<em> </em>$expr1 | ||
<em> </em>&& $expr2 | ||
) { | ||
} | ||
]]> | ||
</code> | ||
<code title="Invalid: Some lines in a multi-line control structure not indented correctly."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
while ( | ||
<em></em>$expr1 | ||
&& $expr2 | ||
<em> </em>&& $expr3 | ||
) { | ||
} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<code_comparison> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<code title="Valid: First expression of a multi-line control structure is on the line after the opening parenthesis."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
while ( | ||
$expr1 | ||
&& $expr2 | ||
) { | ||
} | ||
]]> | ||
</code> | ||
<code title="Invalid: First expression of a multi-line control structure is on the same line as the opening parenthesis."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
while (<em></em>$expr1 | ||
&& $expr2 | ||
) { | ||
} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<code_comparison> | ||
<code title="Valid: The closing parenthesis of a multi-line control structure is on the line after the last expression."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
while ( | ||
$expr1 | ||
&& $expr2 | ||
<em>)</em> { | ||
} | ||
]]> | ||
</code> | ||
<code title="Invalid: The closing parenthesis of a multi-line control structure is on the same line as the last expression."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
while ( | ||
$expr1 | ||
&& $expr2<em>)</em> { | ||
} | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<code_comparison> | ||
<code title="Valid: The closing parenthesis of a multi-line control structure is indented to the same level as start of the control structure."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
while ( | ||
$expr1 | ||
&& $expr2 | ||
) { | ||
} | ||
]]> | ||
</code> | ||
<code title="Invalid: The closing parenthesis of a multi-line control structure is not indented to the same level as start of the control structure."> | ||
dingo-d marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<![CDATA[ | ||
while ( | ||
$expr1 | ||
&& $expr2 | ||
<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.