File tree 1 file changed +98
-0
lines changed
src/Standards/Squiz/Docs/WhiteSpace
1 file changed +98
-0
lines changed Original file line number Diff line number Diff line change
1
+ <documentation title =" Superfluous Whitespace" >
2
+ <standard >
3
+ <![CDATA[
4
+ There should be no superfluous whitespace at the start of a file.
5
+ ]]>
6
+ </standard >
7
+ <code_comparison >
8
+ <code title =" Valid: No whitespace preceding first content in file." >
9
+ <![CDATA[ <?php
10
+ echo 'opening PHP tag at start of file';
11
+ ]]>
12
+ </code >
13
+ <code title =" Invalid: Whitespace used before content in file." >
14
+ <![CDATA[
15
+ <em> </em>
16
+ <?php
17
+ echo 'whitespace before opening PHP tag';
18
+ ]]>
19
+ </code >
20
+ </code_comparison >
21
+ <standard >
22
+ <![CDATA[
23
+ There should be no trailing whitespace at the end of lines.
24
+ ]]>
25
+ </standard >
26
+ <code_comparison >
27
+ <code title =" Valid: No whitespace found at end of line." >
28
+ <![CDATA[
29
+ echo 'semicolon followed by new line char';
30
+ ]]>
31
+ </code >
32
+ <code title =" Invalid: Whitespace found at end of line." >
33
+ <![CDATA[
34
+ echo 'trailing spaces after semicolon';<em> </em>
35
+ ]]>
36
+ </code >
37
+ </code_comparison >
38
+ <standard >
39
+ <![CDATA[
40
+ There should be no consecutive blank lines in functions.
41
+ ]]>
42
+ </standard >
43
+ <code_comparison >
44
+ <code title =" Valid: Functions do not contain multiple empty lines in a row." >
45
+ <![CDATA[
46
+ function myFunction()
47
+ {
48
+ echo 'code here';
49
+
50
+ echo 'code here';
51
+ }
52
+ ]]>
53
+ </code >
54
+ <code title =" Invalid: Functions contain multiple empty lines in a row." >
55
+ <![CDATA[
56
+ function myFunction()
57
+ {
58
+ echo 'code here';
59
+ <em>
60
+
61
+ </em>echo 'code here';
62
+ }
63
+ ]]>
64
+ </code >
65
+ </code_comparison >
66
+ <standard >
67
+ <![CDATA[
68
+ There should be no superfluous whitespace after the final closing PHP tag in a file.
69
+ ]]>
70
+ </standard >
71
+ <code_comparison >
72
+ <code title =" Valid: A single new line appears after the last content in the file." >
73
+ <![CDATA[
74
+ function myFunction()
75
+ {
76
+ echo 'Closing PHP tag, then';
77
+ echo 'Single new line char, then EOF';
78
+ }
79
+
80
+ ?><em>
81
+ </em>
82
+ ]]>
83
+ </code >
84
+ <code title =" Invalid: Multiple new lines appear after the last content in the file." >
85
+ <![CDATA[
86
+ function myFunction()
87
+ {
88
+ echo 'Closing PHP tag, then';
89
+ echo 'Multiple new line chars, then EOF';
90
+ }
91
+
92
+ ?><em>
93
+
94
+ </em>
95
+ ]]>
96
+ </code >
97
+ </code_comparison >
98
+ </documentation >
You can’t perform that action at this time.
0 commit comments