Skip to content

[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
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 Dec 23, 2023
f4fabf1
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
62cd376
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
baf28e9
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
5961ed8
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
e2f79ab
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
4ac58b1
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
c14c5dd
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
8041c8b
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
a57752b
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
0b63cb0
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
1bf2c27
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
f6ec02b
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
383618b
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
cdeef4d
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
c62e10f
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 17, 2024
a1795c1
Improve readability of the documentation
dingo-d Jan 18, 2024
b38b4b7
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 22, 2024
f593a53
Fix suggestions from the PR
dingo-d Jan 25, 2024
6a22d05
Update the standard description for single line control structures
dingo-d Jan 26, 2024
77366bb
Update src/Standards/PSR12/Docs/ControlStructures/ControlStructureSpa…
dingo-d Jan 26, 2024
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
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.">
<![CDATA[
if ($expr) {
}
]]>
</code>
<code title="Invalid: Space after the opening parenthesis.">
<![CDATA[
if (<em> </em>$expr) {
}
]]>
</code>
</code_comparison>
<code_comparison>
<code title="Valid: No space before the closing parenthesis.">
<![CDATA[
if ($expr) {
}
]]>
</code>
<code title="Invalid: Space before the closing parenthesis.">
<![CDATA[
if ($expr<em> </em>) {
}
]]>
</code>
</code_comparison>
<code_comparison>
<code title="Valid: Each line in a multi-line control structure indented at least once. Default indentation is 4 spaces.">
<![CDATA[
while (
<em> </em>$expr1
<em> </em>&& $expr2
) {
}
]]>
</code>
<code title="Invalid: Some lines in a multi-line control structure not indented correctly.">
<![CDATA[
while (
<em></em>$expr1
&& $expr2
<em> </em>&& $expr3
) {
}
]]>
</code>
</code_comparison>
<code_comparison>
<code title="Valid: First expression of a multi-line control structure is on the line after the opening parenthesis.">
<![CDATA[
while (
$expr1
&& $expr2
) {
}
]]>
</code>
<code title="Invalid: First expression of a multi-line control structure is on the same line as the opening parenthesis.">
<![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.">
<![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.">
<![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.">
<![CDATA[
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.">
<![CDATA[
while (
$expr1
&& $expr2
<em> </em>) {
}
]]>
</code>
</code_comparison>
</documentation>