Skip to content

Commit 84a17c2

Browse files
braindawgjrfnl
authored andcommitted
[Docs] Add XML doc for Squiz.Classes.ClassFileName sniff (#843)
* Add XML doc for Squiz\Classes\ClassFileName sniff * [Doc] Emphasize sniff focus for ClassFileName Adjusts the `<em>` tags in the Squiz.Classes.ClassFileName sniff XML docs to better highlight the parts of the code samples that illustrate the purpose of the sniff. * Correct file/class name relation in sniff doc Per PR #845, the filename must be modified to match the class name, since class names are much more restrictive than filenames and the inverse is not always possible. This clarifies in the example titles that the fix for the invalid code is to modify the filename rather than the class name.
1 parent a36b8e2 commit 84a17c2

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<documentation title="Class File Name">
2+
<standard>
3+
<![CDATA[
4+
The file name and the name of the class defined within the file must match exactly, including case.
5+
]]>
6+
</standard>
7+
<code_comparison>
8+
<code title="Valid: Defined class name and filename match.">
9+
<![CDATA[
10+
/* ./src/<em>Foo.php</em> contents: */
11+
12+
class <em>Foo</em>
13+
{
14+
}
15+
]]>
16+
</code>
17+
<code title="Invalid: Filename does not match class name.">
18+
<![CDATA[
19+
/* ./src/<em>Foo.php</em> contents: */
20+
21+
class <em>MyFoo</em>
22+
{
23+
}
24+
]]>
25+
</code>
26+
</code_comparison>
27+
<code_comparison>
28+
<code title="Valid: Class name and filename use the same casing.">
29+
<![CDATA[
30+
/* ./src/<em>MyFoo.php</em> contents: */
31+
32+
class <em>MyFoo</em>
33+
{
34+
}
35+
]]>
36+
</code>
37+
<code title="Invalid: Filename case does not match class name case.">
38+
<![CDATA[
39+
/* ./src/<em>myFoo.php</em> contents: */
40+
41+
class <em>MyFoo</em>
42+
{
43+
}
44+
]]>
45+
</code>
46+
</code_comparison>
47+
</documentation>

0 commit comments

Comments
 (0)