Skip to content

Commit 22edcb3

Browse files
authored
Added PSR-2 documentation XML files (#3832)
Documentation for the following PSR2 sniffs: * `PSR2.Files.ClosingTag` * `PSR2.Methods.FunctionCallSignature` * `PSR2.Methods.FunctionClosingBrace`
1 parent 6067ef4 commit 22edcb3

File tree

4 files changed

+159
-0
lines changed

4 files changed

+159
-0
lines changed

package.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,9 +1378,12 @@ http://pear.php.net/dtd/package-2.0.xsd">
13781378
<file baseinstalldir="PHP/CodeSniffer" name="SwitchDeclarationStandard.xml" role="php" />
13791379
</dir>
13801380
<dir name="Files">
1381+
<file baseinstalldir="PHP/CodeSniffer" name="ClosingTagStandard.xml" role="php" />
13811382
<file baseinstalldir="PHP/CodeSniffer" name="EndFileNewlineStandard.xml" role="php" />
13821383
</dir>
13831384
<dir name="Methods">
1385+
<file baseinstalldir="PHP/CodeSniffer" name="FunctionCallSignatureStandard.xml" role="php" />
1386+
<file baseinstalldir="PHP/CodeSniffer" name="FunctionClosingBraceStandard.xml" role="php" />
13841387
<file baseinstalldir="PHP/CodeSniffer" name="MethodDeclarationStandard.xml" role="php" />
13851388
</dir>
13861389
<dir name="Namespaces">
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<documentation title="Closing Tag">
2+
<standard>
3+
<![CDATA[
4+
Checks that the file does not end with a closing tag.
5+
]]>
6+
</standard>
7+
<code_comparison>
8+
<code title="Valid: Closing tag not used.">
9+
<![CDATA[
10+
<?php
11+
echo 'Foo';
12+
<em></em>
13+
]]>
14+
</code>
15+
<code title="Invalid: Closing tag used.">
16+
<![CDATA[
17+
<?php
18+
echo 'Foo';
19+
<em>?></em>
20+
]]>
21+
</code>
22+
</code_comparison>
23+
</documentation>
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<documentation title="Function Call Signature">
2+
<standard>
3+
<![CDATA[
4+
Checks that the function call format is correct.
5+
]]>
6+
</standard>
7+
<code_comparison>
8+
<code title="Valid: Correct spacing is used around parentheses.">
9+
<![CDATA[
10+
foo<em></em>(<em></em>$bar, $baz<em></em>);
11+
]]>
12+
</code>
13+
<code title="Invalid: Incorrect spacing used, too much space around the parentheses.">
14+
<![CDATA[
15+
foo<em> </em>(<em> </em>$bar, $baz<em> </em>);
16+
]]>
17+
</code>
18+
</code_comparison>
19+
<code_comparison>
20+
<code title="Valid: Correct number of spaces used for indent in a multi-line function call.">
21+
<![CDATA[
22+
foo(
23+
<em> </em>$bar,
24+
<em> </em>$baz
25+
);
26+
]]>
27+
</code>
28+
<code title="Invalid: Incorrect number of spaces used for indent in a multi-line function call.">
29+
<![CDATA[
30+
foo(
31+
<em> </em>$bar,
32+
<em> </em>$baz
33+
);
34+
]]>
35+
</code>
36+
</code_comparison>
37+
<code_comparison>
38+
<code title="Valid: Closing parenthesis for a multi-line function call is on a new line after the last parameter.">
39+
<![CDATA[
40+
foo(
41+
$bar,
42+
$baz
43+
<em>)</em>;
44+
]]>
45+
</code>
46+
<code title="Invalid: Closing parenthesis for a multi-line function call is not on a new line after the last parameter.">
47+
<![CDATA[
48+
foo(
49+
$bar,
50+
$baz<em>)</em>;
51+
]]>
52+
</code>
53+
</code_comparison>
54+
<code_comparison>
55+
<code title="Valid: The first argument of a multi-line function call is on a new line.">
56+
<![CDATA[
57+
foo(
58+
<em>$bar</em>,
59+
$baz
60+
);
61+
]]>
62+
</code>
63+
<code title="Invalid: The first argument of a multi-line function call is not on a new line.">
64+
<![CDATA[
65+
foo(<em>$bar</em>,
66+
$baz
67+
);
68+
]]>
69+
</code>
70+
</code_comparison>
71+
<code_comparison>
72+
<code title="Valid: Only one argument per line in a multi-line function call.">
73+
<![CDATA[
74+
foo(
75+
$bar,
76+
<em>$baz</em>
77+
);
78+
]]>
79+
</code>
80+
<code title="Invalid: Two or more arguments per line in a multi-line function call.">
81+
<![CDATA[
82+
foo(
83+
$bar, <em>$baz</em>
84+
);
85+
]]>
86+
</code>
87+
</code_comparison>
88+
<code_comparison>
89+
<code title="Valid: No blank lines in a multi-line function call.">
90+
<![CDATA[
91+
foo(
92+
$bar,
93+
$baz
94+
);
95+
]]>
96+
</code>
97+
<code title="Invalid: Blank line in multi-line function call.">
98+
<![CDATA[
99+
foo(
100+
$bar,
101+
<em></em>
102+
$baz
103+
);
104+
]]>
105+
</code>
106+
</code_comparison>
107+
</documentation>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<documentation title="Function Closing Brace">
2+
<standard>
3+
<![CDATA[
4+
Checks that the closing brace of a function goes directly after the body.
5+
]]>
6+
</standard>
7+
<code_comparison>
8+
<code title="Valid: Closing brace directly follows the function body.">
9+
<![CDATA[
10+
function foo()
11+
{
12+
echo 'foo';
13+
<em>}</em>
14+
]]>
15+
</code>
16+
<code title="Invalid: Blank line between the function body and the closing brace.">
17+
<![CDATA[
18+
function foo()
19+
{
20+
echo 'foo';
21+
<em></em>
22+
<em>}</em>
23+
]]>
24+
</code>
25+
</code_comparison>
26+
</documentation>

0 commit comments

Comments
 (0)