@@ -15,104 +15,104 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Get a list of CLI values to set before the file is tested. |
|
20 | - * |
|
21 | - * @param string $testFile The name of the file being tested. |
|
22 | - * @param \PHP_CodeSniffer\Config $config The config data for the test run. |
|
23 | - * |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function setCliValues($testFile, $config) |
|
27 | - { |
|
28 | - if ($testFile === 'DisallowSpaceIndentUnitTest.2.inc') { |
|
29 | - return; |
|
30 | - } |
|
18 | + /** |
|
19 | + * Get a list of CLI values to set before the file is tested. |
|
20 | + * |
|
21 | + * @param string $testFile The name of the file being tested. |
|
22 | + * @param \PHP_CodeSniffer\Config $config The config data for the test run. |
|
23 | + * |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function setCliValues($testFile, $config) |
|
27 | + { |
|
28 | + if ($testFile === 'DisallowSpaceIndentUnitTest.2.inc') { |
|
29 | + return; |
|
30 | + } |
|
31 | 31 | |
32 | - $config->tabWidth = 4; |
|
32 | + $config->tabWidth = 4; |
|
33 | 33 | |
34 | - }//end setCliValues() |
|
34 | + }//end setCliValues() |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * Returns the lines where errors should occur. |
|
39 | - * |
|
40 | - * The key of the array should represent the line number and the value |
|
41 | - * should represent the number of errors that should occur on that line. |
|
42 | - * |
|
43 | - * @param string $testFile The name of the file being tested. |
|
44 | - * |
|
45 | - * @return array<int, int> |
|
46 | - */ |
|
47 | - public function getErrorList($testFile='DisallowSpaceIndentUnitTest.1.inc') |
|
48 | - { |
|
49 | - switch ($testFile) { |
|
50 | - case 'DisallowSpaceIndentUnitTest.1.inc': |
|
51 | - case 'DisallowSpaceIndentUnitTest.2.inc': |
|
52 | - return [ |
|
53 | - 5 => 1, |
|
54 | - 9 => 1, |
|
55 | - 15 => 1, |
|
56 | - 22 => 1, |
|
57 | - 24 => 1, |
|
58 | - 30 => 1, |
|
59 | - 35 => 1, |
|
60 | - 50 => 1, |
|
61 | - 55 => 1, |
|
62 | - 57 => 1, |
|
63 | - 58 => 1, |
|
64 | - 59 => 1, |
|
65 | - 60 => 1, |
|
66 | - 65 => 1, |
|
67 | - 66 => 1, |
|
68 | - 67 => 1, |
|
69 | - 68 => 1, |
|
70 | - 69 => 1, |
|
71 | - 70 => 1, |
|
72 | - 73 => 1, |
|
73 | - 77 => 1, |
|
74 | - 81 => 1, |
|
75 | - 104 => 1, |
|
76 | - 105 => 1, |
|
77 | - 106 => 1, |
|
78 | - 107 => 1, |
|
79 | - 108 => 1, |
|
80 | - 110 => 1, |
|
81 | - 111 => 1, |
|
82 | - 112 => 1, |
|
83 | - 114 => 1, |
|
84 | - 115 => 1, |
|
85 | - 117 => 1, |
|
86 | - 118 => 1, |
|
87 | - ]; |
|
88 | - break; |
|
89 | - case 'DisallowSpaceIndentUnitTest.js': |
|
90 | - return [3 => 1]; |
|
91 | - break; |
|
92 | - case 'DisallowSpaceIndentUnitTest.css': |
|
93 | - return [2 => 1]; |
|
94 | - break; |
|
95 | - default: |
|
96 | - return []; |
|
97 | - break; |
|
98 | - }//end switch |
|
37 | + /** |
|
38 | + * Returns the lines where errors should occur. |
|
39 | + * |
|
40 | + * The key of the array should represent the line number and the value |
|
41 | + * should represent the number of errors that should occur on that line. |
|
42 | + * |
|
43 | + * @param string $testFile The name of the file being tested. |
|
44 | + * |
|
45 | + * @return array<int, int> |
|
46 | + */ |
|
47 | + public function getErrorList($testFile='DisallowSpaceIndentUnitTest.1.inc') |
|
48 | + { |
|
49 | + switch ($testFile) { |
|
50 | + case 'DisallowSpaceIndentUnitTest.1.inc': |
|
51 | + case 'DisallowSpaceIndentUnitTest.2.inc': |
|
52 | + return [ |
|
53 | + 5 => 1, |
|
54 | + 9 => 1, |
|
55 | + 15 => 1, |
|
56 | + 22 => 1, |
|
57 | + 24 => 1, |
|
58 | + 30 => 1, |
|
59 | + 35 => 1, |
|
60 | + 50 => 1, |
|
61 | + 55 => 1, |
|
62 | + 57 => 1, |
|
63 | + 58 => 1, |
|
64 | + 59 => 1, |
|
65 | + 60 => 1, |
|
66 | + 65 => 1, |
|
67 | + 66 => 1, |
|
68 | + 67 => 1, |
|
69 | + 68 => 1, |
|
70 | + 69 => 1, |
|
71 | + 70 => 1, |
|
72 | + 73 => 1, |
|
73 | + 77 => 1, |
|
74 | + 81 => 1, |
|
75 | + 104 => 1, |
|
76 | + 105 => 1, |
|
77 | + 106 => 1, |
|
78 | + 107 => 1, |
|
79 | + 108 => 1, |
|
80 | + 110 => 1, |
|
81 | + 111 => 1, |
|
82 | + 112 => 1, |
|
83 | + 114 => 1, |
|
84 | + 115 => 1, |
|
85 | + 117 => 1, |
|
86 | + 118 => 1, |
|
87 | + ]; |
|
88 | + break; |
|
89 | + case 'DisallowSpaceIndentUnitTest.js': |
|
90 | + return [3 => 1]; |
|
91 | + break; |
|
92 | + case 'DisallowSpaceIndentUnitTest.css': |
|
93 | + return [2 => 1]; |
|
94 | + break; |
|
95 | + default: |
|
96 | + return []; |
|
97 | + break; |
|
98 | + }//end switch |
|
99 | 99 | |
100 | - }//end getErrorList() |
|
100 | + }//end getErrorList() |
|
101 | 101 | |
102 | 102 | |
103 | - /** |
|
104 | - * Returns the lines where warnings should occur. |
|
105 | - * |
|
106 | - * The key of the array should represent the line number and the value |
|
107 | - * should represent the number of warnings that should occur on that line. |
|
108 | - * |
|
109 | - * @return array<int, int> |
|
110 | - */ |
|
111 | - public function getWarningList() |
|
112 | - { |
|
113 | - return []; |
|
103 | + /** |
|
104 | + * Returns the lines where warnings should occur. |
|
105 | + * |
|
106 | + * The key of the array should represent the line number and the value |
|
107 | + * should represent the number of warnings that should occur on that line. |
|
108 | + * |
|
109 | + * @return array<int, int> |
|
110 | + */ |
|
111 | + public function getWarningList() |
|
112 | + { |
|
113 | + return []; |
|
114 | 114 | |
115 | - }//end getWarningList() |
|
115 | + }//end getWarningList() |
|
116 | 116 | |
117 | 117 | |
118 | 118 | }//end class |
@@ -47,54 +47,54 @@ |
||
47 | 47 | public function getErrorList($testFile='DisallowSpaceIndentUnitTest.1.inc') |
48 | 48 | { |
49 | 49 | switch ($testFile) { |
50 | - case 'DisallowSpaceIndentUnitTest.1.inc': |
|
51 | - case 'DisallowSpaceIndentUnitTest.2.inc': |
|
52 | - return [ |
|
53 | - 5 => 1, |
|
54 | - 9 => 1, |
|
55 | - 15 => 1, |
|
56 | - 22 => 1, |
|
57 | - 24 => 1, |
|
58 | - 30 => 1, |
|
59 | - 35 => 1, |
|
60 | - 50 => 1, |
|
61 | - 55 => 1, |
|
62 | - 57 => 1, |
|
63 | - 58 => 1, |
|
64 | - 59 => 1, |
|
65 | - 60 => 1, |
|
66 | - 65 => 1, |
|
67 | - 66 => 1, |
|
68 | - 67 => 1, |
|
69 | - 68 => 1, |
|
70 | - 69 => 1, |
|
71 | - 70 => 1, |
|
72 | - 73 => 1, |
|
73 | - 77 => 1, |
|
74 | - 81 => 1, |
|
75 | - 104 => 1, |
|
76 | - 105 => 1, |
|
77 | - 106 => 1, |
|
78 | - 107 => 1, |
|
79 | - 108 => 1, |
|
80 | - 110 => 1, |
|
81 | - 111 => 1, |
|
82 | - 112 => 1, |
|
83 | - 114 => 1, |
|
84 | - 115 => 1, |
|
85 | - 117 => 1, |
|
86 | - 118 => 1, |
|
87 | - ]; |
|
88 | - break; |
|
89 | - case 'DisallowSpaceIndentUnitTest.js': |
|
90 | - return [3 => 1]; |
|
91 | - break; |
|
92 | - case 'DisallowSpaceIndentUnitTest.css': |
|
93 | - return [2 => 1]; |
|
94 | - break; |
|
95 | - default: |
|
96 | - return []; |
|
97 | - break; |
|
50 | + case 'DisallowSpaceIndentUnitTest.1.inc': |
|
51 | + case 'DisallowSpaceIndentUnitTest.2.inc': |
|
52 | + return [ |
|
53 | + 5 => 1, |
|
54 | + 9 => 1, |
|
55 | + 15 => 1, |
|
56 | + 22 => 1, |
|
57 | + 24 => 1, |
|
58 | + 30 => 1, |
|
59 | + 35 => 1, |
|
60 | + 50 => 1, |
|
61 | + 55 => 1, |
|
62 | + 57 => 1, |
|
63 | + 58 => 1, |
|
64 | + 59 => 1, |
|
65 | + 60 => 1, |
|
66 | + 65 => 1, |
|
67 | + 66 => 1, |
|
68 | + 67 => 1, |
|
69 | + 68 => 1, |
|
70 | + 69 => 1, |
|
71 | + 70 => 1, |
|
72 | + 73 => 1, |
|
73 | + 77 => 1, |
|
74 | + 81 => 1, |
|
75 | + 104 => 1, |
|
76 | + 105 => 1, |
|
77 | + 106 => 1, |
|
78 | + 107 => 1, |
|
79 | + 108 => 1, |
|
80 | + 110 => 1, |
|
81 | + 111 => 1, |
|
82 | + 112 => 1, |
|
83 | + 114 => 1, |
|
84 | + 115 => 1, |
|
85 | + 117 => 1, |
|
86 | + 118 => 1, |
|
87 | + ]; |
|
88 | + break; |
|
89 | + case 'DisallowSpaceIndentUnitTest.js': |
|
90 | + return [3 => 1]; |
|
91 | + break; |
|
92 | + case 'DisallowSpaceIndentUnitTest.css': |
|
93 | + return [2 => 1]; |
|
94 | + break; |
|
95 | + default: |
|
96 | + return []; |
|
97 | + break; |
|
98 | 98 | }//end switch |
99 | 99 | |
100 | 100 | }//end getErrorList() |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | - public function setCliValues($testFile, $config) |
|
26 | + public function setCliValues( $testFile, $config ) |
|
27 | 27 | { |
28 | - if ($testFile === 'DisallowSpaceIndentUnitTest.2.inc') { |
|
28 | + if ( $testFile === 'DisallowSpaceIndentUnitTest.2.inc' ) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return array<int, int> |
46 | 46 | */ |
47 | - public function getErrorList($testFile='DisallowSpaceIndentUnitTest.1.inc') |
|
47 | + public function getErrorList( $testFile = 'DisallowSpaceIndentUnitTest.1.inc' ) |
|
48 | 48 | { |
49 | - switch ($testFile) { |
|
49 | + switch ( $testFile ) { |
|
50 | 50 | case 'DisallowSpaceIndentUnitTest.1.inc': |
51 | 51 | case 'DisallowSpaceIndentUnitTest.2.inc': |
52 | 52 | return [ |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | ]; |
88 | 88 | break; |
89 | 89 | case 'DisallowSpaceIndentUnitTest.js': |
90 | - return [3 => 1]; |
|
90 | + return [ 3 => 1 ]; |
|
91 | 91 | break; |
92 | 92 | case 'DisallowSpaceIndentUnitTest.css': |
93 | - return [2 => 1]; |
|
93 | + return [ 2 => 1 ]; |
|
94 | 94 | break; |
95 | 95 | default: |
96 | - return []; |
|
96 | + return [ ]; |
|
97 | 97 | break; |
98 | 98 | }//end switch |
99 | 99 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function getWarningList() |
112 | 112 | { |
113 | - return []; |
|
113 | + return [ ]; |
|
114 | 114 | |
115 | 115 | }//end getWarningList() |
116 | 116 |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class DisallowSpaceIndentUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class DisallowSpaceIndentUnitTest extends AbstractSniffUnitTest { |
|
16 | 15 | |
17 | 16 | |
18 | 17 | /** |
@@ -23,8 +22,7 @@ discard block |
||
23 | 22 | * |
24 | 23 | * @return void |
25 | 24 | */ |
26 | - public function setCliValues($testFile, $config) |
|
27 | - { |
|
25 | + public function setCliValues($testFile, $config) { |
|
28 | 26 | if ($testFile === 'DisallowSpaceIndentUnitTest.2.inc') { |
29 | 27 | return; |
30 | 28 | } |
@@ -44,8 +42,7 @@ discard block |
||
44 | 42 | * |
45 | 43 | * @return array<int, int> |
46 | 44 | */ |
47 | - public function getErrorList($testFile='DisallowSpaceIndentUnitTest.1.inc') |
|
48 | - { |
|
45 | + public function getErrorList($testFile='DisallowSpaceIndentUnitTest.1.inc') { |
|
49 | 46 | switch ($testFile) { |
50 | 47 | case 'DisallowSpaceIndentUnitTest.1.inc': |
51 | 48 | case 'DisallowSpaceIndentUnitTest.2.inc': |
@@ -108,8 +105,7 @@ discard block |
||
108 | 105 | * |
109 | 106 | * @return array<int, int> |
110 | 107 | */ |
111 | - public function getWarningList() |
|
112 | - { |
|
108 | + public function getWarningList() { |
|
113 | 109 | return []; |
114 | 110 | |
115 | 111 | }//end getWarningList() |
@@ -15,191 +15,191 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Get a list of CLI values to set before the file is tested. |
|
20 | - * |
|
21 | - * @param string $testFile The name of the file being tested. |
|
22 | - * @param \PHP_CodeSniffer\Config $config The config data for the test run. |
|
23 | - * |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function setCliValues($testFile, $config) |
|
27 | - { |
|
28 | - // Tab width setting is only needed for the tabbed file. |
|
29 | - if ($testFile === 'ScopeIndentUnitTest.2.inc') { |
|
30 | - $config->tabWidth = 4; |
|
31 | - } else { |
|
32 | - $config->tabWidth = 0; |
|
33 | - } |
|
34 | - |
|
35 | - }//end setCliValues() |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * Returns the lines where errors should occur. |
|
40 | - * |
|
41 | - * The key of the array should represent the line number and the value |
|
42 | - * should represent the number of errors that should occur on that line. |
|
43 | - * |
|
44 | - * @param string $testFile The name of the file being tested. |
|
45 | - * |
|
46 | - * @return array<int, int> |
|
47 | - */ |
|
48 | - public function getErrorList($testFile='ScopeIndentUnitTest.inc') |
|
49 | - { |
|
50 | - if ($testFile === 'ScopeIndentUnitTest.1.js') { |
|
51 | - return [ |
|
52 | - 6 => 1, |
|
53 | - 14 => 1, |
|
54 | - 21 => 1, |
|
55 | - 30 => 1, |
|
56 | - 32 => 1, |
|
57 | - 33 => 1, |
|
58 | - 34 => 1, |
|
59 | - 39 => 1, |
|
60 | - 42 => 1, |
|
61 | - 59 => 1, |
|
62 | - 60 => 1, |
|
63 | - 75 => 1, |
|
64 | - 120 => 1, |
|
65 | - 121 => 1, |
|
66 | - 122 => 1, |
|
67 | - 123 => 1, |
|
68 | - 141 => 1, |
|
69 | - 142 => 1, |
|
70 | - 155 => 1, |
|
71 | - 156 => 1, |
|
72 | - 168 => 1, |
|
73 | - 184 => 1, |
|
74 | - ]; |
|
75 | - }//end if |
|
76 | - |
|
77 | - if ($testFile === 'ScopeIndentUnitTest.3.inc') { |
|
78 | - return [ |
|
79 | - 6 => 1, |
|
80 | - 7 => 1, |
|
81 | - 10 => 1, |
|
82 | - ]; |
|
83 | - } |
|
84 | - |
|
85 | - if ($testFile === 'ScopeIndentUnitTest.4.inc') { |
|
86 | - return []; |
|
87 | - } |
|
88 | - |
|
89 | - return [ |
|
90 | - 7 => 1, |
|
91 | - 10 => 1, |
|
92 | - 13 => 1, |
|
93 | - 17 => 1, |
|
94 | - 20 => 1, |
|
95 | - 24 => 1, |
|
96 | - 25 => 1, |
|
97 | - 27 => 1, |
|
98 | - 28 => 1, |
|
99 | - 29 => 1, |
|
100 | - 30 => 1, |
|
101 | - 58 => 1, |
|
102 | - 123 => 1, |
|
103 | - 224 => 1, |
|
104 | - 225 => 1, |
|
105 | - 279 => 1, |
|
106 | - 280 => 1, |
|
107 | - 281 => 1, |
|
108 | - 282 => 1, |
|
109 | - 283 => 1, |
|
110 | - 284 => 1, |
|
111 | - 285 => 1, |
|
112 | - 286 => 1, |
|
113 | - 336 => 1, |
|
114 | - 349 => 1, |
|
115 | - 380 => 1, |
|
116 | - 386 => 1, |
|
117 | - 387 => 1, |
|
118 | - 388 => 1, |
|
119 | - 389 => 1, |
|
120 | - 390 => 1, |
|
121 | - 397 => 1, |
|
122 | - 419 => 1, |
|
123 | - 420 => 1, |
|
124 | - 465 => 1, |
|
125 | - 467 => 1, |
|
126 | - 472 => 1, |
|
127 | - 473 => 1, |
|
128 | - 474 => 1, |
|
129 | - 496 => 1, |
|
130 | - 498 => 1, |
|
131 | - 500 => 1, |
|
132 | - 524 => 1, |
|
133 | - 526 => 1, |
|
134 | - 544 => 1, |
|
135 | - 545 => 1, |
|
136 | - 546 => 1, |
|
137 | - 639 => 1, |
|
138 | - 660 => 1, |
|
139 | - 662 => 1, |
|
140 | - 802 => 1, |
|
141 | - 803 => 1, |
|
142 | - 823 => 1, |
|
143 | - 858 => 1, |
|
144 | - 879 => 1, |
|
145 | - 1163 => 1, |
|
146 | - 1197 => 1, |
|
147 | - 1198 => 1, |
|
148 | - 1259 => 1, |
|
149 | - 1264 => 1, |
|
150 | - 1265 => 1, |
|
151 | - 1266 => 1, |
|
152 | - 1269 => 1, |
|
153 | - 1272 => 1, |
|
154 | - 1273 => 1, |
|
155 | - 1274 => 1, |
|
156 | - 1275 => 1, |
|
157 | - 1276 => 1, |
|
158 | - 1277 => 1, |
|
159 | - 1280 => 1, |
|
160 | - 1281 => 1, |
|
161 | - 1282 => 1, |
|
162 | - 1284 => 1, |
|
163 | - 1285 => 1, |
|
164 | - 1288 => 1, |
|
165 | - 1289 => 1, |
|
166 | - 1290 => 1, |
|
167 | - 1292 => 1, |
|
168 | - 1293 => 1, |
|
169 | - 1310 => 1, |
|
170 | - 1312 => 1, |
|
171 | - 1327 => 1, |
|
172 | - 1328 => 1, |
|
173 | - 1329 => 1, |
|
174 | - 1330 => 1, |
|
175 | - 1331 => 1, |
|
176 | - 1332 => 1, |
|
177 | - 1335 => 1, |
|
178 | - 1340 => 1, |
|
179 | - 1342 => 1, |
|
180 | - 1345 => 1, |
|
181 | - 1411 => 1, |
|
182 | - 1412 => 1, |
|
183 | - 1413 => 1, |
|
184 | - 1414 => 1, |
|
185 | - ]; |
|
186 | - |
|
187 | - }//end getErrorList() |
|
188 | - |
|
189 | - |
|
190 | - /** |
|
191 | - * Returns the lines where warnings should occur. |
|
192 | - * |
|
193 | - * The key of the array should represent the line number and the value |
|
194 | - * should represent the number of warnings that should occur on that line. |
|
195 | - * |
|
196 | - * @return array<int, int> |
|
197 | - */ |
|
198 | - public function getWarningList() |
|
199 | - { |
|
200 | - return []; |
|
201 | - |
|
202 | - }//end getWarningList() |
|
18 | + /** |
|
19 | + * Get a list of CLI values to set before the file is tested. |
|
20 | + * |
|
21 | + * @param string $testFile The name of the file being tested. |
|
22 | + * @param \PHP_CodeSniffer\Config $config The config data for the test run. |
|
23 | + * |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function setCliValues($testFile, $config) |
|
27 | + { |
|
28 | + // Tab width setting is only needed for the tabbed file. |
|
29 | + if ($testFile === 'ScopeIndentUnitTest.2.inc') { |
|
30 | + $config->tabWidth = 4; |
|
31 | + } else { |
|
32 | + $config->tabWidth = 0; |
|
33 | + } |
|
34 | + |
|
35 | + }//end setCliValues() |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * Returns the lines where errors should occur. |
|
40 | + * |
|
41 | + * The key of the array should represent the line number and the value |
|
42 | + * should represent the number of errors that should occur on that line. |
|
43 | + * |
|
44 | + * @param string $testFile The name of the file being tested. |
|
45 | + * |
|
46 | + * @return array<int, int> |
|
47 | + */ |
|
48 | + public function getErrorList($testFile='ScopeIndentUnitTest.inc') |
|
49 | + { |
|
50 | + if ($testFile === 'ScopeIndentUnitTest.1.js') { |
|
51 | + return [ |
|
52 | + 6 => 1, |
|
53 | + 14 => 1, |
|
54 | + 21 => 1, |
|
55 | + 30 => 1, |
|
56 | + 32 => 1, |
|
57 | + 33 => 1, |
|
58 | + 34 => 1, |
|
59 | + 39 => 1, |
|
60 | + 42 => 1, |
|
61 | + 59 => 1, |
|
62 | + 60 => 1, |
|
63 | + 75 => 1, |
|
64 | + 120 => 1, |
|
65 | + 121 => 1, |
|
66 | + 122 => 1, |
|
67 | + 123 => 1, |
|
68 | + 141 => 1, |
|
69 | + 142 => 1, |
|
70 | + 155 => 1, |
|
71 | + 156 => 1, |
|
72 | + 168 => 1, |
|
73 | + 184 => 1, |
|
74 | + ]; |
|
75 | + }//end if |
|
76 | + |
|
77 | + if ($testFile === 'ScopeIndentUnitTest.3.inc') { |
|
78 | + return [ |
|
79 | + 6 => 1, |
|
80 | + 7 => 1, |
|
81 | + 10 => 1, |
|
82 | + ]; |
|
83 | + } |
|
84 | + |
|
85 | + if ($testFile === 'ScopeIndentUnitTest.4.inc') { |
|
86 | + return []; |
|
87 | + } |
|
88 | + |
|
89 | + return [ |
|
90 | + 7 => 1, |
|
91 | + 10 => 1, |
|
92 | + 13 => 1, |
|
93 | + 17 => 1, |
|
94 | + 20 => 1, |
|
95 | + 24 => 1, |
|
96 | + 25 => 1, |
|
97 | + 27 => 1, |
|
98 | + 28 => 1, |
|
99 | + 29 => 1, |
|
100 | + 30 => 1, |
|
101 | + 58 => 1, |
|
102 | + 123 => 1, |
|
103 | + 224 => 1, |
|
104 | + 225 => 1, |
|
105 | + 279 => 1, |
|
106 | + 280 => 1, |
|
107 | + 281 => 1, |
|
108 | + 282 => 1, |
|
109 | + 283 => 1, |
|
110 | + 284 => 1, |
|
111 | + 285 => 1, |
|
112 | + 286 => 1, |
|
113 | + 336 => 1, |
|
114 | + 349 => 1, |
|
115 | + 380 => 1, |
|
116 | + 386 => 1, |
|
117 | + 387 => 1, |
|
118 | + 388 => 1, |
|
119 | + 389 => 1, |
|
120 | + 390 => 1, |
|
121 | + 397 => 1, |
|
122 | + 419 => 1, |
|
123 | + 420 => 1, |
|
124 | + 465 => 1, |
|
125 | + 467 => 1, |
|
126 | + 472 => 1, |
|
127 | + 473 => 1, |
|
128 | + 474 => 1, |
|
129 | + 496 => 1, |
|
130 | + 498 => 1, |
|
131 | + 500 => 1, |
|
132 | + 524 => 1, |
|
133 | + 526 => 1, |
|
134 | + 544 => 1, |
|
135 | + 545 => 1, |
|
136 | + 546 => 1, |
|
137 | + 639 => 1, |
|
138 | + 660 => 1, |
|
139 | + 662 => 1, |
|
140 | + 802 => 1, |
|
141 | + 803 => 1, |
|
142 | + 823 => 1, |
|
143 | + 858 => 1, |
|
144 | + 879 => 1, |
|
145 | + 1163 => 1, |
|
146 | + 1197 => 1, |
|
147 | + 1198 => 1, |
|
148 | + 1259 => 1, |
|
149 | + 1264 => 1, |
|
150 | + 1265 => 1, |
|
151 | + 1266 => 1, |
|
152 | + 1269 => 1, |
|
153 | + 1272 => 1, |
|
154 | + 1273 => 1, |
|
155 | + 1274 => 1, |
|
156 | + 1275 => 1, |
|
157 | + 1276 => 1, |
|
158 | + 1277 => 1, |
|
159 | + 1280 => 1, |
|
160 | + 1281 => 1, |
|
161 | + 1282 => 1, |
|
162 | + 1284 => 1, |
|
163 | + 1285 => 1, |
|
164 | + 1288 => 1, |
|
165 | + 1289 => 1, |
|
166 | + 1290 => 1, |
|
167 | + 1292 => 1, |
|
168 | + 1293 => 1, |
|
169 | + 1310 => 1, |
|
170 | + 1312 => 1, |
|
171 | + 1327 => 1, |
|
172 | + 1328 => 1, |
|
173 | + 1329 => 1, |
|
174 | + 1330 => 1, |
|
175 | + 1331 => 1, |
|
176 | + 1332 => 1, |
|
177 | + 1335 => 1, |
|
178 | + 1340 => 1, |
|
179 | + 1342 => 1, |
|
180 | + 1345 => 1, |
|
181 | + 1411 => 1, |
|
182 | + 1412 => 1, |
|
183 | + 1413 => 1, |
|
184 | + 1414 => 1, |
|
185 | + ]; |
|
186 | + |
|
187 | + }//end getErrorList() |
|
188 | + |
|
189 | + |
|
190 | + /** |
|
191 | + * Returns the lines where warnings should occur. |
|
192 | + * |
|
193 | + * The key of the array should represent the line number and the value |
|
194 | + * should represent the number of warnings that should occur on that line. |
|
195 | + * |
|
196 | + * @return array<int, int> |
|
197 | + */ |
|
198 | + public function getWarningList() |
|
199 | + { |
|
200 | + return []; |
|
201 | + |
|
202 | + }//end getWarningList() |
|
203 | 203 | |
204 | 204 | |
205 | 205 | }//end class |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | - public function setCliValues($testFile, $config) |
|
26 | + public function setCliValues( $testFile, $config ) |
|
27 | 27 | { |
28 | 28 | // Tab width setting is only needed for the tabbed file. |
29 | - if ($testFile === 'ScopeIndentUnitTest.2.inc') { |
|
29 | + if ( $testFile === 'ScopeIndentUnitTest.2.inc' ) { |
|
30 | 30 | $config->tabWidth = 4; |
31 | 31 | } else { |
32 | 32 | $config->tabWidth = 0; |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return array<int, int> |
47 | 47 | */ |
48 | - public function getErrorList($testFile='ScopeIndentUnitTest.inc') |
|
48 | + public function getErrorList( $testFile = 'ScopeIndentUnitTest.inc' ) |
|
49 | 49 | { |
50 | - if ($testFile === 'ScopeIndentUnitTest.1.js') { |
|
50 | + if ( $testFile === 'ScopeIndentUnitTest.1.js' ) { |
|
51 | 51 | return [ |
52 | 52 | 6 => 1, |
53 | 53 | 14 => 1, |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ]; |
75 | 75 | }//end if |
76 | 76 | |
77 | - if ($testFile === 'ScopeIndentUnitTest.3.inc') { |
|
77 | + if ( $testFile === 'ScopeIndentUnitTest.3.inc' ) { |
|
78 | 78 | return [ |
79 | 79 | 6 => 1, |
80 | 80 | 7 => 1, |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | ]; |
83 | 83 | } |
84 | 84 | |
85 | - if ($testFile === 'ScopeIndentUnitTest.4.inc') { |
|
86 | - return []; |
|
85 | + if ( $testFile === 'ScopeIndentUnitTest.4.inc' ) { |
|
86 | + return [ ]; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | return [ |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function getWarningList() |
199 | 199 | { |
200 | - return []; |
|
200 | + return [ ]; |
|
201 | 201 | |
202 | 202 | }//end getWarningList() |
203 | 203 |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class ScopeIndentUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class ScopeIndentUnitTest extends AbstractSniffUnitTest { |
|
16 | 15 | |
17 | 16 | |
18 | 17 | /** |
@@ -23,8 +22,7 @@ discard block |
||
23 | 22 | * |
24 | 23 | * @return void |
25 | 24 | */ |
26 | - public function setCliValues($testFile, $config) |
|
27 | - { |
|
25 | + public function setCliValues($testFile, $config) { |
|
28 | 26 | // Tab width setting is only needed for the tabbed file. |
29 | 27 | if ($testFile === 'ScopeIndentUnitTest.2.inc') { |
30 | 28 | $config->tabWidth = 4; |
@@ -45,8 +43,7 @@ discard block |
||
45 | 43 | * |
46 | 44 | * @return array<int, int> |
47 | 45 | */ |
48 | - public function getErrorList($testFile='ScopeIndentUnitTest.inc') |
|
49 | - { |
|
46 | + public function getErrorList($testFile='ScopeIndentUnitTest.inc') { |
|
50 | 47 | if ($testFile === 'ScopeIndentUnitTest.1.js') { |
51 | 48 | return [ |
52 | 49 | 6 => 1, |
@@ -195,8 +192,7 @@ discard block |
||
195 | 192 | * |
196 | 193 | * @return array<int, int> |
197 | 194 | */ |
198 | - public function getWarningList() |
|
199 | - { |
|
195 | + public function getWarningList() { |
|
200 | 196 | return []; |
201 | 197 | |
202 | 198 | }//end getWarningList() |
@@ -15,68 +15,68 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Returns the lines where errors should occur. |
|
20 | - * |
|
21 | - * The key of the array should represent the line number and the value |
|
22 | - * should represent the number of errors that should occur on that line. |
|
23 | - * |
|
24 | - * @return array<int, int> |
|
25 | - */ |
|
26 | - public function getErrorList() |
|
27 | - { |
|
28 | - return [ |
|
29 | - 64 => 4, |
|
30 | - 66 => 1, |
|
31 | - 68 => 1, |
|
32 | - 69 => 1, |
|
33 | - 72 => 2, |
|
34 | - 73 => 2, |
|
35 | - 77 => 2, |
|
36 | - 81 => 4, |
|
37 | - 90 => 4, |
|
38 | - 94 => 1, |
|
39 | - 95 => 1, |
|
40 | - 97 => 1, |
|
41 | - 100 => 2, |
|
42 | - 101 => 2, |
|
43 | - 104 => 2, |
|
44 | - 107 => 2, |
|
45 | - 109 => 4, |
|
46 | - 111 => 4, |
|
47 | - 113 => 2, |
|
48 | - 115 => 2, |
|
49 | - 123 => 1, |
|
50 | - 125 => 2, |
|
51 | - 127 => 1, |
|
52 | - 131 => 1, |
|
53 | - 133 => 1, |
|
54 | - 137 => 1, |
|
55 | - 139 => 2, |
|
56 | - 141 => 1, |
|
57 | - 144 => 1, |
|
58 | - 146 => 1, |
|
59 | - ]; |
|
18 | + /** |
|
19 | + * Returns the lines where errors should occur. |
|
20 | + * |
|
21 | + * The key of the array should represent the line number and the value |
|
22 | + * should represent the number of errors that should occur on that line. |
|
23 | + * |
|
24 | + * @return array<int, int> |
|
25 | + */ |
|
26 | + public function getErrorList() |
|
27 | + { |
|
28 | + return [ |
|
29 | + 64 => 4, |
|
30 | + 66 => 1, |
|
31 | + 68 => 1, |
|
32 | + 69 => 1, |
|
33 | + 72 => 2, |
|
34 | + 73 => 2, |
|
35 | + 77 => 2, |
|
36 | + 81 => 4, |
|
37 | + 90 => 4, |
|
38 | + 94 => 1, |
|
39 | + 95 => 1, |
|
40 | + 97 => 1, |
|
41 | + 100 => 2, |
|
42 | + 101 => 2, |
|
43 | + 104 => 2, |
|
44 | + 107 => 2, |
|
45 | + 109 => 4, |
|
46 | + 111 => 4, |
|
47 | + 113 => 2, |
|
48 | + 115 => 2, |
|
49 | + 123 => 1, |
|
50 | + 125 => 2, |
|
51 | + 127 => 1, |
|
52 | + 131 => 1, |
|
53 | + 133 => 1, |
|
54 | + 137 => 1, |
|
55 | + 139 => 2, |
|
56 | + 141 => 1, |
|
57 | + 144 => 1, |
|
58 | + 146 => 1, |
|
59 | + ]; |
|
60 | 60 | |
61 | - }//end getErrorList() |
|
61 | + }//end getErrorList() |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * Returns the lines where warnings should occur. |
|
66 | - * |
|
67 | - * The key of the array should represent the line number and the value |
|
68 | - * should represent the number of warnings that should occur on that line. |
|
69 | - * |
|
70 | - * @return array<int, int> |
|
71 | - */ |
|
72 | - public function getWarningList() |
|
73 | - { |
|
74 | - return [ |
|
75 | - 55 => 1, |
|
76 | - 56 => 1, |
|
77 | - ]; |
|
64 | + /** |
|
65 | + * Returns the lines where warnings should occur. |
|
66 | + * |
|
67 | + * The key of the array should represent the line number and the value |
|
68 | + * should represent the number of warnings that should occur on that line. |
|
69 | + * |
|
70 | + * @return array<int, int> |
|
71 | + */ |
|
72 | + public function getWarningList() |
|
73 | + { |
|
74 | + return [ |
|
75 | + 55 => 1, |
|
76 | + 56 => 1, |
|
77 | + ]; |
|
78 | 78 | |
79 | - }//end getWarningList() |
|
79 | + }//end getWarningList() |
|
80 | 80 | |
81 | 81 | |
82 | 82 | }//end class |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class ArbitraryParenthesesSpacingUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class ArbitraryParenthesesSpacingUnitTest extends AbstractSniffUnitTest { |
|
16 | 15 | |
17 | 16 | |
18 | 17 | /** |
@@ -23,8 +22,7 @@ discard block |
||
23 | 22 | * |
24 | 23 | * @return array<int, int> |
25 | 24 | */ |
26 | - public function getErrorList() |
|
27 | - { |
|
25 | + public function getErrorList() { |
|
28 | 26 | return [ |
29 | 27 | 64 => 4, |
30 | 28 | 66 => 1, |
@@ -69,8 +67,7 @@ discard block |
||
69 | 67 | * |
70 | 68 | * @return array<int, int> |
71 | 69 | */ |
72 | - public function getWarningList() |
|
73 | - { |
|
70 | + public function getWarningList() { |
|
74 | 71 | return [ |
75 | 72 | 55 => 1, |
76 | 73 | 56 => 1, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | |
125 | 125 | /** This is a T_DOC_COMMENT |
126 | - */ |
|
126 | + */ |
|
127 | 127 | |
128 | 128 | /* |
129 | 129 | This T_COMMENT has a newline in it. |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | |
172 | 172 | if (true) { |
173 | - echo 'hello'; |
|
173 | + echo 'hello'; |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | array_push($braces, $token); |
@@ -416,8 +416,8 @@ discard block |
||
416 | 416 | public static function myFunction() |
417 | 417 | { |
418 | 418 | if (empty($keywords) === FALSE) { |
419 | - $keywords = 'foo'; |
|
420 | - $existing = 'foo'; |
|
419 | + $keywords = 'foo'; |
|
420 | + $existing = 'foo'; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | return $keywords; |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | |
665 | 665 | function foo() |
666 | 666 | { |
667 | - $failingTests[$testName][] = array( |
|
667 | + $failingTests[$testName][] = array( |
|
668 | 668 | 'comment' => self::_replaceKeywords($failingComment, $result), |
669 | 669 | 'screenshot' => Test::getScreenshotPath( |
670 | 670 | $projectid, |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | } |
255 | 255 | |
256 | 256 | switch ($foo) { |
257 | - case 1: |
|
258 | - switch ($bar) { |
|
257 | + case 1: |
|
258 | + switch ($bar) { |
|
259 | 259 | default: |
260 | 260 | echo $string{1}; |
261 | - } |
|
261 | + } |
|
262 | 262 | break; |
263 | 263 | } |
264 | 264 | |
@@ -274,25 +274,25 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | switch ($foo) { |
277 | - case 1: |
|
278 | - switch ($bar) { |
|
279 | - default: |
|
280 | - if ($something) { |
|
281 | - echo $string{1}; |
|
282 | - } else if ($else) { |
|
283 | - switch ($else) { |
|
277 | + case 1: |
|
278 | + switch ($bar) { |
|
284 | 279 | default: |
280 | + if ($something) { |
|
281 | + echo $string{1}; |
|
282 | + } else if ($else) { |
|
283 | + switch ($else) { |
|
284 | + default: |
|
285 | + } |
|
285 | 286 | } |
286 | - } |
|
287 | 287 | } |
288 | 288 | break; |
289 | 289 | } |
290 | 290 | |
291 | 291 | switch ($name) { |
292 | - case "1": |
|
293 | - case "2": |
|
294 | - case "3": |
|
295 | - return true; |
|
292 | + case "1": |
|
293 | + case "2": |
|
294 | + case "3": |
|
295 | + return true; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | switch ($name) { |
@@ -314,16 +314,16 @@ discard block |
||
314 | 314 | } |
315 | 315 | |
316 | 316 | switch ($name) { |
317 | - case "1": |
|
318 | - switch ($name2) { |
|
317 | + case "1": |
|
318 | + switch ($name2) { |
|
319 | 319 | case "1": |
320 | 320 | break; |
321 | 321 | case "2": |
322 | 322 | break; |
323 | - } |
|
324 | - break; |
|
325 | - case "2": |
|
323 | + } |
|
326 | 324 | break; |
325 | + case "2": |
|
326 | + break; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | switch (true) { |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | switch (true) { |
342 | - case true: { |
|
343 | - echo 'hi'; |
|
344 | - } |
|
345 | - // No break here. |
|
346 | - case false: |
|
347 | - case true: |
|
348 | - case null:{ |
|
349 | - echo 'hi'; |
|
342 | + case true: { |
|
343 | + echo 'hi'; |
|
344 | + } |
|
345 | + // No break here. |
|
346 | + case false: |
|
347 | + case true: |
|
348 | + case null:{ |
|
350 | 349 | echo 'hi'; |
351 | - } |
|
352 | - break; |
|
350 | + echo 'hi'; |
|
351 | + } |
|
352 | + break; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | switch (true) { |
@@ -910,29 +910,29 @@ discard block |
||
910 | 910 | } |
911 | 911 | |
912 | 912 | switch ($foo) { |
913 | - case 1: |
|
914 | - return array(); |
|
915 | - case 2: |
|
916 | - return ''; |
|
917 | - case 3: |
|
918 | - return $function(); |
|
919 | - case 4: |
|
920 | - return $functionCall($param[0]); |
|
921 | - case 5: |
|
922 | - return array() + array(); // Array Merge |
|
923 | - case 6: |
|
924 | - // String connect |
|
925 | - return $functionReturningString('') . $functionReturningString(array()); |
|
926 | - case 7: |
|
927 | - return functionCall( |
|
928 | - $withMultiLineParam[0], |
|
929 | - array(), |
|
930 | - $functionReturningString( |
|
931 | - $withMultiLineParam[1] |
|
932 | - ) |
|
933 | - ); |
|
934 | - case 8: |
|
935 | - return $param[0][0]; |
|
913 | + case 1: |
|
914 | + return array(); |
|
915 | + case 2: |
|
916 | + return ''; |
|
917 | + case 3: |
|
918 | + return $function(); |
|
919 | + case 4: |
|
920 | + return $functionCall($param[0]); |
|
921 | + case 5: |
|
922 | + return array() + array(); // Array Merge |
|
923 | + case 6: |
|
924 | + // String connect |
|
925 | + return $functionReturningString('') . $functionReturningString(array()); |
|
926 | + case 7: |
|
927 | + return functionCall( |
|
928 | + $withMultiLineParam[0], |
|
929 | + array(), |
|
930 | + $functionReturningString( |
|
931 | + $withMultiLineParam[1] |
|
932 | + ) |
|
933 | + ); |
|
934 | + case 8: |
|
935 | + return $param[0][0]; |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | class Test { |
@@ -948,10 +948,10 @@ discard block |
||
948 | 948 | } |
949 | 949 | |
950 | 950 | switch ($x) { |
951 | - case 1: |
|
952 | - return [1]; |
|
953 | - default: |
|
954 | - return [2]; |
|
951 | + case 1: |
|
952 | + return [1]; |
|
953 | + default: |
|
954 | + return [2]; |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | switch ($foo) { |
@@ -1024,16 +1024,16 @@ discard block |
||
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | switch ($parameter) { |
1027 | - case null: |
|
1028 | - return [ |
|
1029 | - 'foo' => in_array( |
|
1030 | - 'foo', |
|
1031 | - [] |
|
1032 | - ), |
|
1033 | - ]; |
|
1027 | + case null: |
|
1028 | + return [ |
|
1029 | + 'foo' => in_array( |
|
1030 | + 'foo', |
|
1031 | + [] |
|
1032 | + ), |
|
1033 | + ]; |
|
1034 | 1034 | |
1035 | - default: |
|
1036 | - return []; |
|
1035 | + default: |
|
1036 | + return []; |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | class SomeClass |
@@ -1183,11 +1183,11 @@ discard block |
||
1183 | 1183 | } |
1184 | 1184 | |
1185 | 1185 | switch ($a) { |
1186 | - case 0: |
|
1187 | - $a = function () { |
|
1188 | - }; |
|
1189 | - case 1: |
|
1190 | - break; |
|
1186 | + case 0: |
|
1187 | + $a = function () { |
|
1188 | + }; |
|
1189 | + case 1: |
|
1190 | + break; |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | 1193 | class Test |
@@ -1395,14 +1395,14 @@ discard block |
||
1395 | 1395 | |
1396 | 1396 | switch($foo) |
1397 | 1397 | { |
1398 | - case 1: |
|
1399 | - $value = 1; break; |
|
1400 | - case 2: |
|
1401 | - if ($bar) { |
|
1402 | - break; |
|
1403 | - } |
|
1404 | - default: |
|
1405 | - $value = 0; |
|
1398 | + case 1: |
|
1399 | + $value = 1; break; |
|
1400 | + case 2: |
|
1401 | + if ($bar) { |
|
1402 | + break; |
|
1403 | + } |
|
1404 | + default: |
|
1405 | + $value = 0; |
|
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | phpcs:set Generic.WhiteSpace.ScopeIndent tabIndent true |
2 | -<meta name="twitter:site" content="<?php echo $metaTagsData['twitter:site']; ?>"> |
|
2 | +<meta name="twitter:site" content="<?php echo $metaTagsData[ 'twitter:site' ]; ?>"> |
|
3 | 3 | <?php |
4 | 4 | class Test { |
5 | 5 | function __construct() |
@@ -14,24 +14,24 @@ discard block |
||
14 | 14 | |
15 | 15 | function hello2() |
16 | 16 | { |
17 | - if (TRUE) { |
|
17 | + if ( TRUE ) { |
|
18 | 18 | echo 'hello'; // no error here as its more than 4 spaces. |
19 | 19 | } else { |
20 | 20 | echo 'bye'; |
21 | 21 | } |
22 | 22 | |
23 | - while (TRUE) { |
|
23 | + while ( TRUE ) { |
|
24 | 24 | echo 'hello'; |
25 | 25 | } |
26 | 26 | |
27 | 27 | do { |
28 | 28 | echo 'hello'; |
29 | - } while (TRUE); |
|
29 | + } while ( TRUE ); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | function hello3() |
33 | 33 | { |
34 | - switch ($hello) { |
|
34 | + switch ( $hello ) { |
|
35 | 35 | case 'hello': |
36 | 36 | break; |
37 | 37 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | </head> |
45 | 45 | <body> |
46 | 46 | <?php |
47 | -if ($form->validate()) { |
|
47 | +if ( $form->validate() ) { |
|
48 | 48 | $safe = $form->getSubmitValues(); |
49 | 49 | } |
50 | 50 | ?> |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | public function open() |
62 | 62 | { |
63 | 63 | // Some inline stuff that shouldn't error |
64 | - if (TRUE) echo 'hello'; |
|
65 | - foreach ($tokens as $token) echo $token; |
|
64 | + if ( TRUE ) echo 'hello'; |
|
65 | + foreach ( $tokens as $token ) echo $token; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -74,17 +74,17 @@ discard block |
||
74 | 74 | public function close() |
75 | 75 | { |
76 | 76 | // All ok. |
77 | - if (TRUE) { |
|
78 | - if (TRUE) { |
|
79 | - } else if (FALSE) { |
|
80 | - foreach ($tokens as $token) { |
|
81 | - switch ($token) { |
|
77 | + if ( TRUE ) { |
|
78 | + if ( TRUE ) { |
|
79 | + } else if ( FALSE ) { |
|
80 | + foreach ( $tokens as $token ) { |
|
81 | + switch ( $token ) { |
|
82 | 82 | case '1': |
83 | 83 | case '2': |
84 | - if (true) { |
|
85 | - if (false) { |
|
86 | - if (false) { |
|
87 | - if (false) { |
|
84 | + if ( true ) { |
|
85 | + if ( false ) { |
|
86 | + if ( false ) { |
|
87 | + if ( false ) { |
|
88 | 88 | echo 'hello'; |
89 | 89 | } |
90 | 90 | } |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | break; |
96 | 96 | } |
97 | 97 | do { |
98 | - while (true) { |
|
99 | - foreach ($tokens as $token) { |
|
100 | - for ($i = 0; $i < $token; $i++) { |
|
98 | + while ( true ) { |
|
99 | + foreach ( $tokens as $token ) { |
|
100 | + for ( $i = 0; $i < $token; $i++ ) { |
|
101 | 101 | echo 'hello'; |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | - } while (true); |
|
105 | + } while ( true ); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
@@ -152,28 +152,28 @@ discard block |
||
152 | 152 | public function parse() |
153 | 153 | { |
154 | 154 | |
155 | - foreach ($t as $ndx => $token) { |
|
156 | - if (is_array($token)) { |
|
155 | + foreach ( $t as $ndx => $token ) { |
|
156 | + if ( is_array( $token ) ) { |
|
157 | 157 | echo 'here'; |
158 | 158 | } else { |
159 | - $ts[] = array("token" => $token, "value" => ''); |
|
159 | + $ts[ ] = array( "token" => $token, "value" => '' ); |
|
160 | 160 | |
161 | - $last = count($ts) - 1; |
|
161 | + $last = count( $ts ) - 1; |
|
162 | 162 | |
163 | - switch ($token) { |
|
163 | + switch ( $token ) { |
|
164 | 164 | case '(': |
165 | 165 | |
166 | - if ($last >= 3 && |
|
167 | - $ts[0]['token'] != T_CLASS && |
|
168 | - $ts[$last - 2]['token'] == T_OBJECT_OPERATOR && |
|
169 | - $ts[$last - 3]['token'] == T_VARIABLE ) { |
|
166 | + if ( $last >= 3 && |
|
167 | + $ts[ 0 ][ 'token' ] != T_CLASS && |
|
168 | + $ts[ $last - 2 ][ 'token' ] == T_OBJECT_OPERATOR && |
|
169 | + $ts[ $last - 3 ][ 'token' ] == T_VARIABLE ) { |
|
170 | 170 | |
171 | 171 | |
172 | - if (true) { |
|
172 | + if ( true ) { |
|
173 | 173 | echo 'hello'; |
174 | 174 | } |
175 | 175 | } |
176 | - array_push($braces, $token); |
|
176 | + array_push( $braces, $token ); |
|
177 | 177 | break; |
178 | 178 | } |
179 | 179 | } |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | return $o; |
196 | 196 | } |
197 | 197 | |
198 | -if ($a === true || $a === true || $a === true || $a === true || |
|
199 | - $a === true || $a === true || $a === true || $a === true) { |
|
198 | +if ( $a === true || $a === true || $a === true || $a === true || |
|
199 | + $a === true || $a === true || $a === true || $a === true ) { |
|
200 | 200 | |
201 | 201 | echo 'hello'; |
202 | 202 | } |
203 | 203 | |
204 | -if ($true) { |
|
204 | +if ( $true ) { |
|
205 | 205 | /* First comment line |
206 | 206 | * |
207 | 207 | * Comment test here |
@@ -225,47 +225,47 @@ discard block |
||
225 | 225 | # $m[] = 'declare'; |
226 | 226 | } |
227 | 227 | |
228 | -foreach ($elements as $element) { |
|
229 | - if ($something) { |
|
228 | +foreach ( $elements as $element ) { |
|
229 | + if ( $something ) { |
|
230 | 230 | // Do IF. |
231 | - } else if ($somethingElse) { |
|
231 | + } else if ( $somethingElse ) { |
|
232 | 232 | // Do ELSE. |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | -if ($condition) { |
|
236 | +if ( $condition ) { |
|
237 | 237 | echo "This is a long |
238 | 238 | string that spans $numLines lines |
239 | 239 | without indenting. |
240 | 240 | "; |
241 | 241 | } |
242 | 242 | |
243 | -if ($condition) { |
|
243 | +if ( $condition ) { |
|
244 | 244 | echo 'This is a long |
245 | 245 | string that spans multiple lines |
246 | 246 | with indenting. |
247 | 247 | '; |
248 | 248 | } |
249 | 249 | |
250 | -if ($condition) { |
|
250 | +if ( $condition ) { |
|
251 | 251 | echo 'This is a long |
252 | 252 | string that spans multiple lines |
253 | 253 | with indenting.'; |
254 | 254 | } |
255 | 255 | |
256 | -switch ($foo) { |
|
256 | +switch ( $foo ) { |
|
257 | 257 | case 1: |
258 | - switch ($bar) { |
|
258 | + switch ( $bar ) { |
|
259 | 259 | default: |
260 | 260 | echo $string{1}; |
261 | 261 | } |
262 | 262 | break; |
263 | 263 | } |
264 | 264 | |
265 | -function temp($foo, $bar) { |
|
266 | - switch ($foo) { |
|
265 | +function temp( $foo, $bar ) { |
|
266 | + switch ( $foo ) { |
|
267 | 267 | case 1: |
268 | - switch ($bar) { |
|
268 | + switch ( $bar ) { |
|
269 | 269 | default: |
270 | 270 | return $foo; |
271 | 271 | } |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
276 | -switch ($foo) { |
|
276 | +switch ( $foo ) { |
|
277 | 277 | case 1: |
278 | - switch ($bar) { |
|
278 | + switch ( $bar ) { |
|
279 | 279 | default: |
280 | - if ($something) { |
|
280 | + if ( $something ) { |
|
281 | 281 | echo $string{1}; |
282 | - } else if ($else) { |
|
283 | - switch ($else) { |
|
282 | + } else if ( $else ) { |
|
283 | + switch ( $else ) { |
|
284 | 284 | default: |
285 | 285 | } |
286 | 286 | } |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | break; |
289 | 289 | } |
290 | 290 | |
291 | -switch ($name) { |
|
291 | +switch ( $name ) { |
|
292 | 292 | case "1": |
293 | 293 | case "2": |
294 | 294 | case "3": |
295 | 295 | return true; |
296 | 296 | } |
297 | 297 | |
298 | -switch ($name) { |
|
298 | +switch ( $name ) { |
|
299 | 299 | case "1": |
300 | 300 | case "2": |
301 | 301 | case "3": |
@@ -313,9 +313,9 @@ discard block |
||
313 | 313 | |
314 | 314 | } |
315 | 315 | |
316 | -switch ($name) { |
|
316 | +switch ( $name ) { |
|
317 | 317 | case "1": |
318 | - switch ($name2) { |
|
318 | + switch ( $name2 ) { |
|
319 | 319 | case "1": |
320 | 320 | break; |
321 | 321 | case "2": |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | break; |
327 | 327 | } |
328 | 328 | |
329 | -switch (true) { |
|
329 | +switch ( true ) { |
|
330 | 330 | case true: { |
331 | 331 | } |
332 | 332 | echo 'hi'; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | break; |
339 | 339 | } |
340 | 340 | |
341 | -switch (true) { |
|
341 | +switch ( true ) { |
|
342 | 342 | case true: { |
343 | 343 | echo 'hi'; |
344 | 344 | } |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | break; |
353 | 353 | } |
354 | 354 | |
355 | -switch (true) { |
|
355 | +switch ( true ) { |
|
356 | 356 | case true: { |
357 | - if (true) { |
|
357 | + if ( true ) { |
|
358 | 358 | echo 'hi'; |
359 | 359 | } |
360 | 360 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | function c() |
367 | 367 | { |
368 | 368 | $this->doSomething( |
369 | - function () { |
|
369 | + function() { |
|
370 | 370 | echo 123; |
371 | 371 | } |
372 | 372 | ); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | some_function( |
377 | 377 | function() { |
378 | 378 | $a = 403; |
379 | - if ($a === 404) { |
|
379 | + if ( $a === 404 ) { |
|
380 | 380 | $a = 403; |
381 | 381 | } |
382 | 382 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | some_function( |
386 | 386 | function() { |
387 | 387 | $a = 403; |
388 | - if ($a === 404) { |
|
388 | + if ( $a === 404 ) { |
|
389 | 389 | $a = 403; |
390 | 390 | } |
391 | 391 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | |
394 | 394 | $myFunction = function() { |
395 | 395 | $a = 403; |
396 | - if ($a === 404) { |
|
396 | + if ( $a === 404 ) { |
|
397 | 397 | $a = 403; |
398 | 398 | } |
399 | 399 | }; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | { |
416 | 416 | public static function myFunction() |
417 | 417 | { |
418 | - if (empty($keywords) === FALSE) { |
|
418 | + if ( empty( $keywords ) === FALSE ) { |
|
419 | 419 | $keywords = 'foo'; |
420 | 420 | $existing = 'foo'; |
421 | 421 | } |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | }//end class |
428 | 428 | |
429 | 429 | $var = call_user_func( |
430 | - $new_var = function () use (&$a) { |
|
431 | - if ($a > 0) { |
|
430 | + $new_var = function() use ( &$a ) { |
|
431 | + if ( $a > 0 ) { |
|
432 | 432 | return $a++; |
433 | 433 | } else { |
434 | 434 | return $a--; |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | { |
443 | 443 | return array( |
444 | 444 | 'functions' => Array( |
445 | - 'function1' => function ($a, $b, $c) { |
|
445 | + 'function1' => function( $a, $b, $c ) { |
|
446 | 446 | $a = $b + $c; |
447 | 447 | $b = $c / 2; |
448 | - return Array($a, $b, $c); |
|
448 | + return Array( $a, $b, $c ); |
|
449 | 449 | }, |
450 | 450 | ), |
451 | 451 | ); |
@@ -455,29 +455,29 @@ discard block |
||
455 | 455 | |
456 | 456 | <div> |
457 | 457 | <?php |
458 | - if ($myvar == 'test') { |
|
458 | + if ( $myvar == 'test' ) { |
|
459 | 459 | echo 'something'; |
460 | 460 | } |
461 | 461 | ?> |
462 | 462 | <div> |
463 | 463 | <div> |
464 | 464 | <?php |
465 | - if ($myvar == 'test') { |
|
465 | + if ( $myvar == 'test' ) { |
|
466 | 466 | echo 'something'; |
467 | 467 | } |
468 | 468 | ?> |
469 | 469 | <div> |
470 | 470 | <div> |
471 | 471 | <?php |
472 | -if ($myvar == 'test') { |
|
472 | +if ( $myvar == 'test' ) { |
|
473 | 473 | echo 'something'; |
474 | 474 | } |
475 | 475 | ?> |
476 | 476 | <div> |
477 | 477 | <body> |
478 | 478 | <?php |
479 | - if (isset($_GET["test"])) { |
|
480 | - if ($_GET["test"] <> "") { |
|
479 | + if ( isset( $_GET[ "test" ] ) ) { |
|
480 | + if ( $_GET[ "test" ] <> "" ) { |
|
481 | 481 | $test = true; |
482 | 482 | } else { |
483 | 483 | $test = true; |
@@ -487,13 +487,13 @@ discard block |
||
487 | 487 | </body> |
488 | 488 | |
489 | 489 | <?php |
490 | -if (true) { |
|
490 | +if ( true ) { |
|
491 | 491 | ?> |
492 | 492 | <div> |
493 | 493 | <div> |
494 | 494 | <div> |
495 | 495 | <?php |
496 | - if (true) { |
|
496 | + if ( true ) { |
|
497 | 497 | echo 'hello'; |
498 | 498 | } else { |
499 | 499 | echo 'goodbye'; |
@@ -507,47 +507,47 @@ discard block |
||
507 | 507 | echo 'else'; |
508 | 508 | } |
509 | 509 | ?> |
510 | -<?php if (isset($param)) { ?> |
|
510 | +<?php if ( isset( $param ) ) { ?> |
|
511 | 511 | <h3>some text</h3> |
512 | 512 | <?php } |
513 | 513 | |
514 | 514 | $list = [ |
515 | - 'fn' => function ($a) { |
|
516 | - if ($a === true) { |
|
515 | + 'fn' => function( $a ) { |
|
516 | + if ( $a === true ) { |
|
517 | 517 | echo 'hi'; |
518 | 518 | } |
519 | 519 | } |
520 | 520 | ]; |
521 | 521 | |
522 | 522 | $list = [ |
523 | - 'fn' => function ($a) { |
|
524 | - if ($a === true) { |
|
523 | + 'fn' => function( $a ) { |
|
524 | + if ( $a === true ) { |
|
525 | 525 | echo 'hi'; |
526 | 526 | } |
527 | 527 | } |
528 | 528 | ]; |
529 | 529 | |
530 | -if ($foo) { |
|
531 | - foreach ($bar as $baz) { |
|
532 | - if ($baz) { |
|
530 | +if ( $foo ) { |
|
531 | + foreach ( $bar as $baz ) { |
|
532 | + if ( $baz ) { |
|
533 | 533 | ?> |
534 | 534 | <div> |
535 | 535 | <div> |
536 | 536 | <div> |
537 | 537 | <?php |
538 | - if ($baz > 1) { |
|
538 | + if ( $baz > 1 ) { |
|
539 | 539 | echo '1'; |
540 | 540 | } |
541 | 541 | ?> |
542 | 542 | </div> |
543 | 543 | <?php |
544 | - if ($baz > 1) { |
|
544 | + if ( $baz > 1 ) { |
|
545 | 545 | echo '1'; |
546 | 546 | } |
547 | 547 | ?> |
548 | 548 | </div> |
549 | 549 | <?php |
550 | - if ($baz > 1) { |
|
550 | + if ( $baz > 1 ) { |
|
551 | 551 | echo '1'; |
552 | 552 | } |
553 | 553 | ?> |
@@ -558,10 +558,10 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | ?> |
561 | -<title><?= CHtml::encode($this->pageTitle); ?></title> |
|
561 | +<title><?= CHtml::encode( $this->pageTitle ); ?></title> |
|
562 | 562 | |
563 | 563 | <?php |
564 | -if ($foo) { |
|
564 | +if ( $foo ) { |
|
565 | 565 | echo '1'; |
566 | 566 | echo '2'; |
567 | 567 | echo '3'; |
@@ -569,18 +569,18 @@ discard block |
||
569 | 569 | |
570 | 570 | $array = array(); |
571 | 571 | array_map( |
572 | - function($x) |
|
572 | + function( $x ) |
|
573 | 573 | { |
574 | - return trim($x); |
|
574 | + return trim( $x ); |
|
575 | 575 | }, |
576 | 576 | $array |
577 | 577 | ); |
578 | 578 | |
579 | -function foo(){return function(){};} |
|
579 | +function foo() {return function() {};} |
|
580 | 580 | |
581 | -$mockedDatabase->expects($this->at(2)) |
|
582 | - ->with($this->callback( |
|
583 | - function ($subject) |
|
581 | +$mockedDatabase->expects( $this->at( 2 ) ) |
|
582 | + ->with( $this->callback( |
|
583 | + function( $subject ) |
|
584 | 584 | { |
585 | 585 | } |
586 | 586 | ) |
@@ -589,39 +589,39 @@ discard block |
||
589 | 589 | /** @var Database $mockedDatabase */ |
590 | 590 | /** @var Container $mockedContainer */ |
591 | 591 | |
592 | -echo $string->append('foo') |
|
593 | - ->appaend('bar') |
|
594 | - ->appaend('baz') |
|
592 | +echo $string->append( 'foo' ) |
|
593 | + ->appaend( 'bar' ) |
|
594 | + ->appaend( 'baz' ) |
|
595 | 595 | ->outputUsing( |
596 | - function () |
|
596 | + function() |
|
597 | 597 | { |
598 | 598 | } |
599 | 599 | ); |
600 | 600 | |
601 | 601 | echo PHP_EOL; |
602 | 602 | |
603 | -switch ($arg) { |
|
603 | +switch ( $arg ) { |
|
604 | 604 | case 1: |
605 | 605 | break; |
606 | 606 | case 2: |
607 | - if ($arg2 == 'foo') { |
|
607 | + if ( $arg2 == 'foo' ) { |
|
608 | 608 | } |
609 | 609 | case 3: |
610 | 610 | default: |
611 | 611 | echo 'default'; |
612 | 612 | } |
613 | 613 | |
614 | -if ($tokens[$stackPtr]['content']{0} === '#') { |
|
615 | -} else if ($tokens[$stackPtr]['content']{0} === '/' |
|
616 | - && $tokens[$stackPtr]['content']{1} === '/' |
|
614 | +if ( $tokens[ $stackPtr ][ 'content' ]{0} === '#' ) { |
|
615 | +} else if ( $tokens[ $stackPtr ][ 'content' ]{0} === '/' |
|
616 | + && $tokens[ $stackPtr ][ 'content' ]{1} === '/' |
|
617 | 617 | ) { |
618 | 618 | } |
619 | 619 | |
620 | 620 | $var = call_user_func( |
621 | 621 | function() { |
622 | - if ($foo) { |
|
622 | + if ( $foo ) { |
|
623 | 623 | $new_var = function() { |
624 | - if ($a > 0) { |
|
624 | + if ( $a > 0 ) { |
|
625 | 625 | return $a++; |
626 | 626 | } else { |
627 | 627 | return $a--; |
@@ -643,20 +643,20 @@ discard block |
||
643 | 643 | $var = [ |
644 | 644 | [ |
645 | 645 | '1' => |
646 | - function () { |
|
646 | + function() { |
|
647 | 647 | return true; |
648 | 648 | }, |
649 | 649 | ], |
650 | 650 | [ |
651 | 651 | '1' => |
652 | - function () { |
|
652 | + function() { |
|
653 | 653 | return true; |
654 | 654 | }, |
655 | 655 | '2' => true, |
656 | 656 | ] |
657 | 657 | ]; |
658 | 658 | |
659 | -if ($foo) { |
|
659 | +if ( $foo ) { |
|
660 | 660 | ?> |
661 | 661 | </p> |
662 | 662 | <?php |
@@ -664,11 +664,11 @@ discard block |
||
664 | 664 | |
665 | 665 | function foo() |
666 | 666 | { |
667 | - $failingTests[$testName][] = array( |
|
668 | - 'comment' => self::_replaceKeywords($failingComment, $result), |
|
667 | + $failingTests[ $testName ][ ] = array( |
|
668 | + 'comment' => self::_replaceKeywords( $failingComment, $result ), |
|
669 | 669 | 'screenshot' => Test::getScreenshotPath( |
670 | 670 | $projectid, |
671 | - $result['class_name'], |
|
671 | + $result[ 'class_name' ], |
|
672 | 672 | ), |
673 | 673 | ); |
674 | 674 | |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $this->mockedDatabase |
678 | 678 | ->with( |
679 | 679 | $this->callback( |
680 | - function () { |
|
680 | + function() { |
|
681 | 681 | return; |
682 | 682 | } |
683 | 683 | ) |
@@ -687,20 +687,20 @@ discard block |
||
687 | 687 | |
688 | 688 | function a() |
689 | 689 | { |
690 | - if (true) { |
|
691 | - static::$a[$b] = |
|
692 | - static::where($c) |
|
693 | - ->where($c) |
|
690 | + if ( true ) { |
|
691 | + static::$a[ $b ] = |
|
692 | + static::where( $c ) |
|
693 | + ->where( $c ) |
|
694 | 694 | ->where( |
695 | - function ($d) { |
|
695 | + function( $d ) { |
|
696 | 696 | $d->whereNull(); |
697 | 697 | $d->orWhere(); |
698 | 698 | } |
699 | 699 | ) |
700 | 700 | ->first(); |
701 | 701 | |
702 | - if (static::$a[$b] === null) { |
|
703 | - static::$a[$b] = new static( |
|
702 | + if ( static::$a[ $b ] === null ) { |
|
703 | + static::$a[ $b ] = new static( |
|
704 | 704 | array( |
705 | 705 | 'a' => $a->id, |
706 | 706 | 'a' => $a->id, |
@@ -709,12 +709,12 @@ discard block |
||
709 | 709 | } |
710 | 710 | } |
711 | 711 | |
712 | - return static::$a[$b]; |
|
712 | + return static::$a[ $b ]; |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | $foo->load( |
716 | 716 | array( |
717 | - 'bar' => function ($baz) { |
|
717 | + 'bar' => function( $baz ) { |
|
718 | 718 | $baz->call(); |
719 | 719 | } |
720 | 720 | ) |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | |
725 | 725 | $foo = array_unique( |
726 | 726 | array_map( |
727 | - function ($entry) { |
|
727 | + function( $entry ) { |
|
728 | 728 | return $entry * 2; |
729 | 729 | }, |
730 | 730 | array() |
731 | 731 | ) |
732 | 732 | ); |
733 | -bar($foo); |
|
733 | +bar( $foo ); |
|
734 | 734 | |
735 | 735 | class PHP_CodeSniffer_Tokenizers_JS |
736 | 736 | { |
@@ -747,11 +747,11 @@ discard block |
||
747 | 747 | } |
748 | 748 | |
749 | 749 | echo $string-> |
750 | - append('foo')-> |
|
751 | - appaend('bar')-> |
|
752 | - appaend('baz')-> |
|
750 | + append( 'foo' )-> |
|
751 | + appaend( 'bar' )-> |
|
752 | + appaend( 'baz' )-> |
|
753 | 753 | outputUsing( |
754 | - function () |
|
754 | + function() |
|
755 | 755 | { |
756 | 756 | } |
757 | 757 | ); |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | $str = 'the items I want to show are: ' . |
760 | 760 | implode( |
761 | 761 | ', ', |
762 | - array('a', 'b', 'c') |
|
762 | + array( 'a', 'b', 'c' ) |
|
763 | 763 | ); |
764 | 764 | |
765 | 765 | echo $str; |
@@ -770,16 +770,16 @@ discard block |
||
770 | 770 | |
771 | 771 | echo $str; |
772 | 772 | |
773 | -bar([ |
|
774 | - 'foo' => foo(function () { |
|
773 | +bar( [ |
|
774 | + 'foo' => foo( function() { |
|
775 | 775 | return 'foo'; |
776 | 776 | }) |
777 | -]); |
|
777 | +] ); |
|
778 | 778 | |
779 | 779 | $domains = array_unique( |
780 | 780 | array_map( |
781 | - function ($url) { |
|
782 | - $urlObject = new \Purl\Url($url); |
|
781 | + function( $url ) { |
|
782 | + $urlObject = new \Purl\Url( $url ); |
|
783 | 783 | return $urlObject->registerableDomain; |
784 | 784 | }, |
785 | 785 | $sites |
@@ -788,27 +788,27 @@ discard block |
||
788 | 788 | |
789 | 789 | return $domains; |
790 | 790 | |
791 | -if ($a == 5) : |
|
791 | +if ( $a == 5 ) : |
|
792 | 792 | echo "a equals 5"; |
793 | 793 | echo "..."; |
794 | -elseif ($a == 6) : |
|
794 | +elseif ( $a == 6 ) : |
|
795 | 795 | echo "a equals 6"; |
796 | 796 | echo "!!!"; |
797 | 797 | else : |
798 | 798 | echo "a is neither 5 nor 6"; |
799 | 799 | endif; |
800 | 800 | |
801 | -if ($foo): |
|
802 | -if ($bar) $foo = 1; |
|
803 | -elseif ($baz) $foo = 2; |
|
801 | +if ( $foo ): |
|
802 | +if ( $bar ) $foo = 1; |
|
803 | +elseif ( $baz ) $foo = 2; |
|
804 | 804 | endif; |
805 | 805 | |
806 | 806 | $this |
807 | - ->method(array( |
|
807 | + ->method( array( |
|
808 | 808 | 'foo' => 'bar', |
809 | 809 | ), 'arg', array( |
810 | 810 | 'foo' => 'bar', |
811 | - )); |
|
811 | + ) ); |
|
812 | 812 | |
813 | 813 | class Foo |
814 | 814 | { |
@@ -827,10 +827,10 @@ discard block |
||
827 | 827 | foo(); |
828 | 828 | |
829 | 829 | array( |
830 | - 'key1' => function ($bar) { |
|
830 | + 'key1' => function( $bar ) { |
|
831 | 831 | return $bar; |
832 | 832 | }, |
833 | - 'key2' => function ($foo) { |
|
833 | + 'key2' => function( $foo ) { |
|
834 | 834 | return $foo; |
835 | 835 | }, |
836 | 836 | ); |
@@ -845,10 +845,10 @@ discard block |
||
845 | 845 | |
846 | 846 | try { |
847 | 847 | echo 'foo'; |
848 | -} catch (\Exception $e) { |
|
848 | +} catch ( \Exception $e ) { |
|
849 | 849 | echo 'catch'; |
850 | 850 | } finally { |
851 | - if (false) { |
|
851 | + if ( false ) { |
|
852 | 852 | echo 'finally false'; |
853 | 853 | } |
854 | 854 | } |
@@ -895,21 +895,21 @@ discard block |
||
895 | 895 | { |
896 | 896 | public function get() |
897 | 897 | { |
898 | - $foo = ['b' => 'c', |
|
898 | + $foo = [ 'b' => 'c', |
|
899 | 899 | 'd' => [ |
900 | - ['e' => 'f'] |
|
901 | - ]]; |
|
900 | + [ 'e' => 'f' ] |
|
901 | + ] ]; |
|
902 | 902 | echo '42'; |
903 | 903 | |
904 | - $foo = array('b' => 'c', |
|
904 | + $foo = array( 'b' => 'c', |
|
905 | 905 | 'd' => array( |
906 | - array('e' => 'f') |
|
907 | - )); |
|
906 | + array( 'e' => 'f' ) |
|
907 | + ) ); |
|
908 | 908 | echo '42'; |
909 | 909 | } |
910 | 910 | } |
911 | 911 | |
912 | -switch ($foo) { |
|
912 | +switch ( $foo ) { |
|
913 | 913 | case 1: |
914 | 914 | return array(); |
915 | 915 | case 2: |
@@ -917,22 +917,22 @@ discard block |
||
917 | 917 | case 3: |
918 | 918 | return $function(); |
919 | 919 | case 4: |
920 | - return $functionCall($param[0]); |
|
920 | + return $functionCall( $param[ 0 ] ); |
|
921 | 921 | case 5: |
922 | 922 | return array() + array(); // Array Merge |
923 | 923 | case 6: |
924 | 924 | // String connect |
925 | - return $functionReturningString('') . $functionReturningString(array()); |
|
925 | + return $functionReturningString( '' ) . $functionReturningString( array() ); |
|
926 | 926 | case 7: |
927 | 927 | return functionCall( |
928 | - $withMultiLineParam[0], |
|
928 | + $withMultiLineParam[ 0 ], |
|
929 | 929 | array(), |
930 | 930 | $functionReturningString( |
931 | - $withMultiLineParam[1] |
|
931 | + $withMultiLineParam[ 1 ] |
|
932 | 932 | ) |
933 | 933 | ); |
934 | 934 | case 8: |
935 | - return $param[0][0]; |
|
935 | + return $param[ 0 ][ 0 ]; |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | class Test { |
@@ -947,40 +947,40 @@ discard block |
||
947 | 947 | } |
948 | 948 | } |
949 | 949 | |
950 | -switch ($x) { |
|
950 | +switch ( $x ) { |
|
951 | 951 | case 1: |
952 | - return [1]; |
|
952 | + return [ 1 ]; |
|
953 | 953 | default: |
954 | - return [2]; |
|
954 | + return [ 2 ]; |
|
955 | 955 | } |
956 | 956 | |
957 | -switch ($foo) { |
|
957 | +switch ( $foo ) { |
|
958 | 958 | case self::FOO: |
959 | - return $this->bar($gfoo, function ($id) { |
|
960 | - return FOO::bar($id); |
|
961 | - }, $values); |
|
959 | + return $this->bar( $gfoo, function( $id ) { |
|
960 | + return FOO::bar( $id ); |
|
961 | + }, $values ); |
|
962 | 962 | case self::BAR: |
963 | - $values = $this->bar($foo, $values); |
|
963 | + $values = $this->bar( $foo, $values ); |
|
964 | 964 | break; |
965 | 965 | } |
966 | 966 | |
967 | 967 | $var = array( |
968 | 968 | 'long description' => |
969 | - array(0, 'something'), |
|
969 | + array( 0, 'something' ), |
|
970 | 970 | 'another long description' => |
971 | - array(1, "something else") |
|
971 | + array( 1, "something else" ) |
|
972 | 972 | ); |
973 | 973 | |
974 | 974 | $services = array( |
975 | 975 | 'service 1' => |
976 | - Mockery::mock('class 1') |
|
977 | - ->shouldReceive('setFilter')->once() |
|
978 | - ->shouldReceive('getNbResults')->atLeast()->once() |
|
979 | - ->shouldReceive('getSlice')->once()->andReturn(array()) |
|
976 | + Mockery::mock( 'class 1' ) |
|
977 | + ->shouldReceive( 'setFilter' )->once() |
|
978 | + ->shouldReceive( 'getNbResults' )->atLeast()->once() |
|
979 | + ->shouldReceive( 'getSlice' )->once()->andReturn( array() ) |
|
980 | 980 | ->getMock(), |
981 | 981 | 'service 2' => |
982 | - Mockery::mock('class 2') |
|
983 | - ->shouldReceive('__invoke')->once() |
|
982 | + Mockery::mock( 'class 2' ) |
|
983 | + ->shouldReceive( '__invoke' )->once() |
|
984 | 984 | ->getMock() |
985 | 985 | ); |
986 | 986 | |
@@ -996,71 +996,71 @@ discard block |
||
996 | 996 | |
997 | 997 | try { |
998 | 998 | foo(); |
999 | -} catch (\Exception $e) { |
|
999 | +} catch ( \Exception $e ) { |
|
1000 | 1000 | $foo = function() { |
1001 | 1001 | return 'foo'; |
1002 | 1002 | }; |
1003 | 1003 | |
1004 | - if (true) { |
|
1004 | + if ( true ) { |
|
1005 | 1005 | } |
1006 | 1006 | } |
1007 | 1007 | |
1008 | -if ($foo) { |
|
1008 | +if ( $foo ) { |
|
1009 | 1009 | foo(); |
1010 | -} else if ($e) { |
|
1010 | +} else if ( $e ) { |
|
1011 | 1011 | $foo = function() { |
1012 | 1012 | return 'foo'; |
1013 | 1013 | }; |
1014 | 1014 | |
1015 | - if (true) { |
|
1015 | + if ( true ) { |
|
1016 | 1016 | } |
1017 | 1017 | } else { |
1018 | 1018 | $foo = function() { |
1019 | 1019 | return 'foo'; |
1020 | 1020 | }; |
1021 | 1021 | |
1022 | - if (true) { |
|
1022 | + if ( true ) { |
|
1023 | 1023 | } |
1024 | 1024 | } |
1025 | 1025 | |
1026 | -switch ($parameter) { |
|
1026 | +switch ( $parameter ) { |
|
1027 | 1027 | case null: |
1028 | 1028 | return [ |
1029 | 1029 | 'foo' => in_array( |
1030 | 1030 | 'foo', |
1031 | - [] |
|
1031 | + [ ] |
|
1032 | 1032 | ), |
1033 | 1033 | ]; |
1034 | 1034 | |
1035 | 1035 | default: |
1036 | - return []; |
|
1036 | + return [ ]; |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | class SomeClass |
1040 | 1040 | { |
1041 | 1041 | public function someFunc() |
1042 | 1042 | { |
1043 | - a(function () { |
|
1043 | + a( function() { |
|
1044 | 1044 | echo "a"; |
1045 | - })->b(function () { |
|
1045 | + })->b( function() { |
|
1046 | 1046 | echo "b"; |
1047 | 1047 | }); |
1048 | 1048 | |
1049 | - if (true) { |
|
1049 | + if ( true ) { |
|
1050 | 1050 | echo "c"; |
1051 | 1051 | } |
1052 | 1052 | echo "d"; |
1053 | 1053 | } |
1054 | 1054 | } |
1055 | 1055 | |
1056 | -$params = self::validate_parameters(self::read_competency_framework_parameters(), |
|
1056 | +$params = self::validate_parameters( self::read_competency_framework_parameters(), |
|
1057 | 1057 | array( |
1058 | 1058 | 'id' => $id, |
1059 | - )); |
|
1059 | + ) ); |
|
1060 | 1060 | |
1061 | -$framework = api::read_framework($params['id']); |
|
1062 | -self::validate_context($framework->get_context()); |
|
1063 | -$output = $PAGE->get_renderer('tool_lp'); |
|
1061 | +$framework = api::read_framework( $params[ 'id' ] ); |
|
1062 | +self::validate_context( $framework->get_context() ); |
|
1063 | +$output = $PAGE->get_renderer( 'tool_lp' ); |
|
1064 | 1064 | |
1065 | 1065 | class Test123 |
1066 | 1066 | { |
@@ -1084,19 +1084,19 @@ discard block |
||
1084 | 1084 | } |
1085 | 1085 | |
1086 | 1086 | $foo = foo( |
1087 | - function () { |
|
1087 | + function() { |
|
1088 | 1088 | $foo->debug( |
1089 | 1089 | $a, |
1090 | 1090 | $b |
1091 | 1091 | ); |
1092 | 1092 | |
1093 | - if ($a) { |
|
1093 | + if ( $a ) { |
|
1094 | 1094 | $b = $a; |
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | ); |
1098 | 1098 | |
1099 | -if (somethingIsTrue()) { |
|
1099 | +if ( somethingIsTrue() ) { |
|
1100 | 1100 | ?> |
1101 | 1101 | <div> |
1102 | 1102 | <?php |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | 'bar' |
1108 | 1108 | ); |
1109 | 1109 | |
1110 | - if (somethingElseIsTrue()) { |
|
1110 | + if ( somethingElseIsTrue() ) { |
|
1111 | 1111 | doOneThing(); |
1112 | 1112 | } else { |
1113 | 1113 | doTheOtherThing(); |
@@ -1128,17 +1128,17 @@ discard block |
||
1128 | 1128 | ]; |
1129 | 1129 | |
1130 | 1130 | $foo = [ |
1131 | - function () { |
|
1132 | - if ($foo) { |
|
1131 | + function() { |
|
1132 | + if ( $foo ) { |
|
1133 | 1133 | return 'foo'; |
1134 | 1134 | } |
1135 | 1135 | }, |
1136 | 1136 | ]; |
1137 | 1137 | |
1138 | 1138 | $foo |
1139 | - ->bar(foo(function () { |
|
1140 | - }), foo(function () { |
|
1141 | - })); |
|
1139 | + ->bar( foo( function() { |
|
1140 | + }), foo( function() { |
|
1141 | + }) ); |
|
1142 | 1142 | |
1143 | 1143 | echo 'foo'; |
1144 | 1144 | |
@@ -1156,13 +1156,13 @@ discard block |
||
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | $foo = foo( |
1159 | - function () { |
|
1159 | + function() { |
|
1160 | 1160 | $foo->debug( |
1161 | 1161 | $a, |
1162 | 1162 | $b |
1163 | 1163 | ); |
1164 | 1164 | |
1165 | - if ($a) { |
|
1165 | + if ( $a ) { |
|
1166 | 1166 | $b = $a; |
1167 | 1167 | } |
1168 | 1168 | } |
@@ -1170,21 +1170,21 @@ discard block |
||
1170 | 1170 | |
1171 | 1171 | function test() |
1172 | 1172 | { |
1173 | - $array = []; |
|
1174 | - foreach ($array as $data) { |
|
1173 | + $array = [ ]; |
|
1174 | + foreach ( $array as $data ) { |
|
1175 | 1175 | [ |
1176 | 1176 | 'key1' => $var1, |
1177 | 1177 | 'key2' => $var2, |
1178 | 1178 | ] = $data; |
1179 | - foreach ($var1 as $method) { |
|
1179 | + foreach ( $var1 as $method ) { |
|
1180 | 1180 | echo $method . $var2; |
1181 | 1181 | } |
1182 | 1182 | } |
1183 | 1183 | } |
1184 | 1184 | |
1185 | -switch ($a) { |
|
1185 | +switch ( $a ) { |
|
1186 | 1186 | case 0: |
1187 | - $a = function () { |
|
1187 | + $a = function() { |
|
1188 | 1188 | }; |
1189 | 1189 | case 1: |
1190 | 1190 | break; |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | { |
1195 | 1195 | public function __construct() |
1196 | 1196 | { |
1197 | -if (false) { |
|
1197 | +if ( false ) { |
|
1198 | 1198 | echo 0; |
1199 | 1199 | } |
1200 | 1200 | } |
@@ -1209,11 +1209,11 @@ discard block |
||
1209 | 1209 | ], |
1210 | 1210 | |
1211 | 1211 | 'arrayWithArraysInThere' => [ |
1212 | - ['Value1', 'Value1'] |
|
1212 | + [ 'Value1', 'Value1' ] |
|
1213 | 1213 | ], |
1214 | 1214 | ]; |
1215 | 1215 | |
1216 | -switch ($sContext) { |
|
1216 | +switch ( $sContext ) { |
|
1217 | 1217 | case 'SOMETHING': |
1218 | 1218 | case 'CONSTANT': |
1219 | 1219 | do_something(); |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | array_map( |
1232 | - static function ( $item ) { |
|
1232 | + static function( $item ) { |
|
1233 | 1233 | echo $item; |
1234 | 1234 | }, |
1235 | 1235 | $some_array |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | /** |
1239 | 1239 | * Comment. |
1240 | 1240 | */ |
1241 | -$a(function () use ($app) { |
|
1241 | +$a( function() use ( $app ) { |
|
1242 | 1242 | echo 'hi'; |
1243 | 1243 | })(); |
1244 | 1244 | |
@@ -1246,17 +1246,17 @@ discard block |
||
1246 | 1246 | |
1247 | 1247 | function foo() |
1248 | 1248 | { |
1249 | - $foo('some |
|
1250 | - long description', function () { |
|
1249 | + $foo( 'some |
|
1250 | + long description', function() { |
|
1251 | 1251 | }); |
1252 | 1252 | |
1253 | - $foo('some |
|
1253 | + $foo( 'some |
|
1254 | 1254 | long |
1255 | - description', function () { |
|
1255 | + description', function() { |
|
1256 | 1256 | }); |
1257 | 1257 | |
1258 | 1258 | $foo( |
1259 | -'some long description', function () { |
|
1259 | +'some long description', function() { |
|
1260 | 1260 | }); |
1261 | 1261 | } |
1262 | 1262 | |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | function foo() { |
1309 | 1309 | echo 'foo'; |
1310 | 1310 | echo 'bar'; |
1311 | - if ($foo) { |
|
1311 | + if ( $foo ) { |
|
1312 | 1312 | echo 'baz'; |
1313 | 1313 | } |
1314 | 1314 | } |
@@ -1323,8 +1323,8 @@ discard block |
||
1323 | 1323 | ]; |
1324 | 1324 | } |
1325 | 1325 | |
1326 | -if ($foo) { |
|
1327 | -if ($oo) { |
|
1326 | +if ( $foo ) { |
|
1327 | +if ( $oo ) { |
|
1328 | 1328 | /* |
1329 | 1329 | * |
1330 | 1330 | * |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | $foo = array( |
1338 | 1338 | ); |
1339 | 1339 | |
1340 | - if ($foo) { |
|
1340 | + if ( $foo ) { |
|
1341 | 1341 | echo 'foo'; |
1342 | 1342 | } |
1343 | 1343 | |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | ?> |
1348 | 1348 | |
1349 | 1349 | <div> |
1350 | - <?php if ($foo) { |
|
1350 | + <?php if ( $foo ) { |
|
1351 | 1351 | echo $foo; |
1352 | 1352 | } ?> |
1353 | 1353 | </div> |
@@ -1362,18 +1362,18 @@ discard block |
||
1362 | 1362 | |
1363 | 1363 | <?php |
1364 | 1364 | |
1365 | -if (true) { |
|
1365 | +if ( true ) { |
|
1366 | 1366 | ?> |
1367 | 1367 | <div> |
1368 | 1368 | <?php |
1369 | 1369 | |
1370 | - if (true) { |
|
1370 | + if ( true ) { |
|
1371 | 1371 | ?> |
1372 | 1372 | <?php |
1373 | 1373 | } |
1374 | 1374 | |
1375 | - if (true |
|
1376 | - || false) { |
|
1375 | + if ( true |
|
1376 | + || false ) { |
|
1377 | 1377 | ?> |
1378 | 1378 | <?php |
1379 | 1379 | } |
@@ -1383,22 +1383,22 @@ discard block |
||
1383 | 1383 | <?php |
1384 | 1384 | } |
1385 | 1385 | |
1386 | -foo(function () { |
|
1387 | - if ($conditionA && |
|
1386 | +foo( function() { |
|
1387 | + if ( $conditionA && |
|
1388 | 1388 | $conditionB |
1389 | 1389 | ) { |
1390 | - if ($conditionC) { |
|
1390 | + if ( $conditionC ) { |
|
1391 | 1391 | $a = 1; |
1392 | 1392 | } |
1393 | 1393 | } |
1394 | 1394 | }); |
1395 | 1395 | |
1396 | -switch($foo) |
|
1396 | +switch ( $foo ) |
|
1397 | 1397 | { |
1398 | 1398 | case 1: |
1399 | 1399 | $value = 1; break; |
1400 | 1400 | case 2: |
1401 | - if ($bar) { |
|
1401 | + if ( $bar ) { |
|
1402 | 1402 | break; |
1403 | 1403 | } |
1404 | 1404 | default: |
@@ -1408,9 +1408,9 @@ discard block |
||
1408 | 1408 | ?> |
1409 | 1409 | |
1410 | 1410 | <?php |
1411 | - if (true) { |
|
1411 | + if ( true ) { |
|
1412 | 1412 | } |
1413 | - else if (true) { |
|
1413 | + else if ( true ) { |
|
1414 | 1414 | } |
1415 | 1415 | |
1416 | 1416 | $a = 1; |
@@ -2,18 +2,15 @@ discard block |
||
2 | 2 | <meta name="twitter:site" content="<?php echo $metaTagsData['twitter:site']; ?>"> |
3 | 3 | <?php |
4 | 4 | class Test { |
5 | - function __construct() |
|
6 | - { |
|
5 | + function __construct() { |
|
7 | 6 | $this->hello(); |
8 | 7 | } |
9 | 8 | |
10 | - function hello() |
|
11 | - { |
|
9 | + function hello() { |
|
12 | 10 | echo 'hello'; |
13 | 11 | }//end hello() |
14 | 12 | |
15 | - function hello2() |
|
16 | - { |
|
13 | + function hello2() { |
|
17 | 14 | if (TRUE) { |
18 | 15 | echo 'hello'; // no error here as its more than 4 spaces. |
19 | 16 | } else { |
@@ -29,8 +26,7 @@ discard block |
||
29 | 26 | } while (TRUE); |
30 | 27 | } |
31 | 28 | |
32 | - function hello3() |
|
33 | - { |
|
29 | + function hello3() { |
|
34 | 30 | switch ($hello) { |
35 | 31 | case 'hello': |
36 | 32 | break; |
@@ -51,18 +47,19 @@ discard block |
||
51 | 47 | </pre> |
52 | 48 | <?php |
53 | 49 | |
54 | -class Test2 |
|
55 | -{ |
|
56 | - function __construct() |
|
57 | - { |
|
50 | +class Test2 { |
|
51 | + function __construct() { |
|
58 | 52 | // $this->open(); // error here |
59 | 53 | } |
60 | 54 | |
61 | - public function open() |
|
62 | - { |
|
55 | + public function open() { |
|
63 | 56 | // Some inline stuff that shouldn't error |
64 | - if (TRUE) echo 'hello'; |
|
65 | - foreach ($tokens as $token) echo $token; |
|
57 | + if (TRUE) { |
|
58 | + echo 'hello'; |
|
59 | + } |
|
60 | + foreach ($tokens as $token) { |
|
61 | + echo $token; |
|
62 | + } |
|
66 | 63 | } |
67 | 64 | |
68 | 65 | /** |
@@ -71,8 +68,7 @@ discard block |
||
71 | 68 | * This is a comment 3. |
72 | 69 | * This is a comment 4. |
73 | 70 | */ |
74 | - public function close() |
|
75 | - { |
|
71 | + public function close() { |
|
76 | 72 | // All ok. |
77 | 73 | if (TRUE) { |
78 | 74 | if (TRUE) { |
@@ -130,8 +126,7 @@ discard block |
||
130 | 126 | |
131 | 127 | */ |
132 | 128 | |
133 | - public function read() |
|
134 | - { |
|
129 | + public function read() { |
|
135 | 130 | echo 'hello'; |
136 | 131 | |
137 | 132 | // no errors below. |
@@ -147,10 +142,8 @@ discard block |
||
147 | 142 | } |
148 | 143 | } |
149 | 144 | |
150 | -abstract class Test3 |
|
151 | -{ |
|
152 | - public function parse() |
|
153 | - { |
|
145 | +abstract class Test3 { |
|
146 | + public function parse() { |
|
154 | 147 | |
155 | 148 | foreach ($t as $ndx => $token) { |
156 | 149 | if (is_array($token)) { |
@@ -181,8 +174,7 @@ discard block |
||
181 | 174 | } |
182 | 175 | } |
183 | 176 | |
184 | -function test() |
|
185 | -{ |
|
177 | +function test() { |
|
186 | 178 | $o = <<<EOF |
187 | 179 | this is some text |
188 | 180 | this is some text |
@@ -217,8 +209,7 @@ discard block |
||
217 | 209 | this si something */ |
218 | 210 | } |
219 | 211 | |
220 | -function test() |
|
221 | -{ |
|
212 | +function test() { |
|
222 | 213 | /* taken from http://de3.php.net/manual/en/reserved.php */ |
223 | 214 | # $m[] = 'declare'; |
224 | 215 | /* taken from http://de3.php.net/manual/en/reserved.php */ |
@@ -303,8 +294,7 @@ discard block |
||
303 | 294 | return true; |
304 | 295 | } |
305 | 296 | |
306 | -function myFunction() |
|
307 | -{ |
|
297 | +function myFunction() { |
|
308 | 298 | ?> |
309 | 299 | <dynamic_content> |
310 | 300 | |
@@ -363,8 +353,7 @@ discard block |
||
363 | 353 | |
364 | 354 | // Testing anon function. |
365 | 355 | class a { |
366 | - function c() |
|
367 | - { |
|
356 | + function c() { |
|
368 | 357 | $this->doSomething( |
369 | 358 | function () { |
370 | 359 | echo 123; |
@@ -398,8 +387,7 @@ discard block |
||
398 | 387 | } |
399 | 388 | }; |
400 | 389 | |
401 | -class Whatever |
|
402 | -{ |
|
390 | +class Whatever { |
|
403 | 391 | protected $_protectedArray = array( |
404 | 392 | 'normalString' => 'That email address is already in use!', |
405 | 393 | 'offendingString' => <<<'STRING' |
@@ -411,10 +399,8 @@ discard block |
||
411 | 399 | ); |
412 | 400 | } |
413 | 401 | |
414 | -class MyClass |
|
415 | -{ |
|
416 | - public static function myFunction() |
|
417 | - { |
|
402 | +class MyClass { |
|
403 | + public static function myFunction() { |
|
418 | 404 | if (empty($keywords) === FALSE) { |
419 | 405 | $keywords = 'foo'; |
420 | 406 | $existing = 'foo'; |
@@ -436,10 +422,8 @@ discard block |
||
436 | 422 | } |
437 | 423 | ); |
438 | 424 | |
439 | -class AnonymousFn |
|
440 | -{ |
|
441 | - public function getAnonFn() |
|
442 | - { |
|
425 | +class AnonymousFn { |
|
426 | + public function getAnonFn() { |
|
443 | 427 | return array( |
444 | 428 | 'functions' => Array( |
445 | 429 | 'function1' => function ($a, $b, $c) { |
@@ -569,8 +553,7 @@ discard block |
||
569 | 553 | |
570 | 554 | $array = array(); |
571 | 555 | array_map( |
572 | - function($x) |
|
573 | - { |
|
556 | + function($x) { |
|
574 | 557 | return trim($x); |
575 | 558 | }, |
576 | 559 | $array |
@@ -580,8 +563,7 @@ discard block |
||
580 | 563 | |
581 | 564 | $mockedDatabase->expects($this->at(2)) |
582 | 565 | ->with($this->callback( |
583 | - function ($subject) |
|
584 | - { |
|
566 | + function ($subject) { |
|
585 | 567 | } |
586 | 568 | ) |
587 | 569 | ); |
@@ -593,8 +575,7 @@ discard block |
||
593 | 575 | ->appaend('bar') |
594 | 576 | ->appaend('baz') |
595 | 577 | ->outputUsing( |
596 | - function () |
|
597 | - { |
|
578 | + function () { |
|
598 | 579 | } |
599 | 580 | ); |
600 | 581 | |
@@ -662,8 +643,7 @@ discard block |
||
662 | 643 | <?php |
663 | 644 | } |
664 | 645 | |
665 | -function foo() |
|
666 | -{ |
|
646 | +function foo() { |
|
667 | 647 | $failingTests[$testName][] = array( |
668 | 648 | 'comment' => self::_replaceKeywords($failingComment, $result), |
669 | 649 | 'screenshot' => Test::getScreenshotPath( |
@@ -685,8 +665,7 @@ discard block |
||
685 | 665 | |
686 | 666 | $this->subject->recordLogin(); |
687 | 667 | |
688 | -function a() |
|
689 | -{ |
|
668 | +function a() { |
|
690 | 669 | if (true) { |
691 | 670 | static::$a[$b] = |
692 | 671 | static::where($c) |
@@ -732,8 +711,7 @@ discard block |
||
732 | 711 | ); |
733 | 712 | bar($foo); |
734 | 713 | |
735 | -class PHP_CodeSniffer_Tokenizers_JS |
|
736 | -{ |
|
714 | +class PHP_CodeSniffer_Tokenizers_JS { |
|
737 | 715 | |
738 | 716 | public $scopeOpeners = array( |
739 | 717 | T_CASE => array( |
@@ -751,8 +729,7 @@ discard block |
||
751 | 729 | appaend('bar')-> |
752 | 730 | appaend('baz')-> |
753 | 731 | outputUsing( |
754 | - function () |
|
755 | - { |
|
732 | + function () { |
|
756 | 733 | } |
757 | 734 | ); |
758 | 735 | |
@@ -794,13 +771,18 @@ discard block |
||
794 | 771 | elseif ($a == 6) : |
795 | 772 | echo "a equals 6"; |
796 | 773 | echo "!!!"; |
797 | -else : |
|
774 | +else { |
|
775 | + : |
|
798 | 776 | echo "a is neither 5 nor 6"; |
777 | +} |
|
799 | 778 | endif; |
800 | 779 | |
801 | 780 | if ($foo): |
802 | -if ($bar) $foo = 1; |
|
803 | -elseif ($baz) $foo = 2; |
|
781 | +if ($bar) { |
|
782 | + $foo = 1; |
|
783 | +} elseif ($baz) { |
|
784 | + $foo = 2; |
|
785 | +} |
|
804 | 786 | endif; |
805 | 787 | |
806 | 788 | $this |
@@ -810,15 +792,13 @@ discard block |
||
810 | 792 | 'foo' => 'bar', |
811 | 793 | )); |
812 | 794 | |
813 | -class Foo |
|
814 | -{ |
|
795 | +class Foo { |
|
815 | 796 | use Bar { |
816 | 797 | myMethod as renamedMethod; |
817 | 798 | } |
818 | 799 | } |
819 | 800 | |
820 | -class Foo |
|
821 | -{ |
|
801 | +class Foo { |
|
822 | 802 | use Bar { |
823 | 803 | myMethod as renamedMethod; |
824 | 804 | } |
@@ -853,14 +833,11 @@ discard block |
||
853 | 833 | } |
854 | 834 | } |
855 | 835 | |
856 | -class C0 |
|
857 | -{ |
|
858 | - public function m0() |
|
859 | - { |
|
836 | +class C0 { |
|
837 | + public function m0() { |
|
860 | 838 | } |
861 | 839 | |
862 | - public function m1() |
|
863 | - { |
|
840 | + public function m1() { |
|
864 | 841 | } |
865 | 842 | } |
866 | 843 | |
@@ -891,10 +868,8 @@ discard block |
||
891 | 868 | ]; |
892 | 869 | $c = 2; |
893 | 870 | |
894 | -class foo |
|
895 | -{ |
|
896 | - public function get() |
|
897 | - { |
|
871 | +class foo { |
|
872 | + public function get() { |
|
898 | 873 | $foo = ['b' => 'c', |
899 | 874 | 'd' => [ |
900 | 875 | ['e' => 'f'] |
@@ -984,10 +959,8 @@ discard block |
||
984 | 959 | ->getMock() |
985 | 960 | ); |
986 | 961 | |
987 | -class Foo |
|
988 | -{ |
|
989 | - public function setUp() |
|
990 | - { |
|
962 | +class Foo { |
|
963 | + public function setUp() { |
|
991 | 964 | $this->foo = new class { |
992 | 965 | public $name = 'Some value'; |
993 | 966 | }; |
@@ -1036,10 +1009,8 @@ discard block |
||
1036 | 1009 | return []; |
1037 | 1010 | } |
1038 | 1011 | |
1039 | -class SomeClass |
|
1040 | -{ |
|
1041 | - public function someFunc() |
|
1042 | - { |
|
1012 | +class SomeClass { |
|
1013 | + public function someFunc() { |
|
1043 | 1014 | a(function () { |
1044 | 1015 | echo "a"; |
1045 | 1016 | })->b(function () { |
@@ -1062,8 +1033,7 @@ discard block |
||
1062 | 1033 | self::validate_context($framework->get_context()); |
1063 | 1034 | $output = $PAGE->get_renderer('tool_lp'); |
1064 | 1035 | |
1065 | -class Test123 |
|
1066 | -{ |
|
1036 | +class Test123 { |
|
1067 | 1037 | protected static |
1068 | 1038 | $prop1 = [ |
1069 | 1039 | 'testA' => 123, |
@@ -1168,8 +1138,7 @@ discard block |
||
1168 | 1138 | } |
1169 | 1139 | ); |
1170 | 1140 | |
1171 | -function test() |
|
1172 | -{ |
|
1141 | +function test() { |
|
1173 | 1142 | $array = []; |
1174 | 1143 | foreach ($array as $data) { |
1175 | 1144 | [ |
@@ -1190,10 +1159,8 @@ discard block |
||
1190 | 1159 | break; |
1191 | 1160 | } |
1192 | 1161 | |
1193 | -class Test |
|
1194 | -{ |
|
1195 | - public function __construct() |
|
1196 | - { |
|
1162 | +class Test { |
|
1163 | + public function __construct() { |
|
1197 | 1164 | if (false) { |
1198 | 1165 | echo 0; |
1199 | 1166 | } |
@@ -1244,8 +1211,7 @@ discard block |
||
1244 | 1211 | |
1245 | 1212 | $app->run(); |
1246 | 1213 | |
1247 | -function foo() |
|
1248 | -{ |
|
1214 | +function foo() { |
|
1249 | 1215 | $foo('some |
1250 | 1216 | long description', function () { |
1251 | 1217 | }); |
@@ -1332,8 +1298,7 @@ discard block |
||
1332 | 1298 | } |
1333 | 1299 | } |
1334 | 1300 | |
1335 | - function foo() |
|
1336 | - { |
|
1301 | + function foo() { |
|
1337 | 1302 | $foo = array( |
1338 | 1303 | ); |
1339 | 1304 | |
@@ -1393,8 +1358,7 @@ discard block |
||
1393 | 1358 | } |
1394 | 1359 | }); |
1395 | 1360 | |
1396 | -switch($foo) |
|
1397 | -{ |
|
1361 | +switch($foo) { |
|
1398 | 1362 | case 1: |
1399 | 1363 | $value = 1; break; |
1400 | 1364 | case 2: |
@@ -1409,8 +1373,7 @@ discard block |
||
1409 | 1373 | |
1410 | 1374 | <?php |
1411 | 1375 | if (true) { |
1412 | - } |
|
1413 | - else if (true) { |
|
1376 | + } else if (true) { |
|
1414 | 1377 | } |
1415 | 1378 | |
1416 | 1379 | $a = 1; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | this is some text |
191 | 191 | this is some text |
192 | 192 | this is some text |
193 | -EOF; |
|
193 | +eof; |
|
194 | 194 | |
195 | 195 | return $o; |
196 | 196 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | no matter how many spaces are placed |
408 | 408 | at the beginning of each line |
409 | 409 | and the ending STRING on the next line is reported as having to be indented. |
410 | -STRING |
|
410 | +string |
|
411 | 411 | ); |
412 | 412 | } |
413 | 413 | |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | public function getAnonFn() |
442 | 442 | { |
443 | 443 | return array( |
444 | - 'functions' => Array( |
|
444 | + 'functions' => array( |
|
445 | 445 | 'function1' => function ($a, $b, $c) { |
446 | 446 | $a = $b + $c; |
447 | 447 | $b = $c / 2; |
448 | - return Array($a, $b, $c); |
|
448 | + return array($a, $b, $c); |
|
449 | 449 | }, |
450 | 450 | ), |
451 | 451 | ); |
@@ -1317,8 +1317,8 @@ discard block |
||
1317 | 1317 | function test() { |
1318 | 1318 | return [ |
1319 | 1319 | <<<'SQLDATA' |
1320 | -DATA |
|
1321 | -SQLDATA |
|
1320 | +data |
|
1321 | +sqldata |
|
1322 | 1322 | , |
1323 | 1323 | ]; |
1324 | 1324 | } |
@@ -3,15 +3,15 @@ |
||
3 | 3 | <?php |
4 | 4 | function test() |
5 | 5 | { |
6 | - echo 'test'; |
|
7 | - echo 'test2'; |
|
8 | - echo 'test3'; |
|
9 | - if (true) { |
|
10 | - echo 'test3'; |
|
11 | - } |
|
12 | - echo 'test3'; |
|
13 | - $x = f1( |
|
14 | - 'test1', 'test2', |
|
15 | - 'test3' |
|
16 | - ); |
|
6 | + echo 'test'; |
|
7 | + echo 'test2'; |
|
8 | + echo 'test3'; |
|
9 | + if (true) { |
|
10 | + echo 'test3'; |
|
11 | + } |
|
12 | + echo 'test3'; |
|
13 | + $x = f1( |
|
14 | + 'test1', 'test2', |
|
15 | + 'test3' |
|
16 | + ); |
|
17 | 17 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | echo 'test'; |
7 | 7 | echo 'test2'; |
8 | 8 | echo 'test3'; |
9 | - if (true) { |
|
9 | + if ( true ) { |
|
10 | 10 | echo 'test3'; |
11 | 11 | } |
12 | 12 | echo 'test3'; |
@@ -1,8 +1,7 @@ |
||
1 | 1 | phpcs:set Generic.WhiteSpace.ScopeIndent tabIndent false |
2 | 2 | phpcs:set Generic.WhiteSpace.ScopeIndent exact true |
3 | 3 | <?php |
4 | -function test() |
|
5 | -{ |
|
4 | +function test() { |
|
6 | 5 | echo 'test'; |
7 | 6 | echo 'test2'; |
8 | 7 | echo 'test3'; |
@@ -15,60 +15,60 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Returns the lines where errors should occur. |
|
20 | - * |
|
21 | - * The key of the array should represent the line number and the value |
|
22 | - * should represent the number of errors that should occur on that line. |
|
23 | - * |
|
24 | - * @return array<int, int> |
|
25 | - */ |
|
26 | - public function getErrorList() |
|
27 | - { |
|
28 | - return [ |
|
29 | - 3 => 1, |
|
30 | - 7 => 1, |
|
31 | - 11 => 1, |
|
32 | - 15 => 1, |
|
33 | - 19 => 1, |
|
34 | - 23 => 1, |
|
35 | - 27 => 1, |
|
36 | - 30 => 1, |
|
37 | - 33 => 1, |
|
38 | - 34 => 1, |
|
39 | - 35 => 1, |
|
40 | - 36 => 1, |
|
41 | - 38 => 1, |
|
42 | - 44 => 1, |
|
43 | - 45 => 1, |
|
44 | - 46 => 2, |
|
45 | - 49 => 1, |
|
46 | - 51 => 1, |
|
47 | - 59 => 1, |
|
48 | - 61 => 1, |
|
49 | - 63 => 1, |
|
50 | - 67 => 1, |
|
51 | - 70 => 1, |
|
52 | - 71 => 1, |
|
53 | - 75 => 1, |
|
54 | - ]; |
|
18 | + /** |
|
19 | + * Returns the lines where errors should occur. |
|
20 | + * |
|
21 | + * The key of the array should represent the line number and the value |
|
22 | + * should represent the number of errors that should occur on that line. |
|
23 | + * |
|
24 | + * @return array<int, int> |
|
25 | + */ |
|
26 | + public function getErrorList() |
|
27 | + { |
|
28 | + return [ |
|
29 | + 3 => 1, |
|
30 | + 7 => 1, |
|
31 | + 11 => 1, |
|
32 | + 15 => 1, |
|
33 | + 19 => 1, |
|
34 | + 23 => 1, |
|
35 | + 27 => 1, |
|
36 | + 30 => 1, |
|
37 | + 33 => 1, |
|
38 | + 34 => 1, |
|
39 | + 35 => 1, |
|
40 | + 36 => 1, |
|
41 | + 38 => 1, |
|
42 | + 44 => 1, |
|
43 | + 45 => 1, |
|
44 | + 46 => 2, |
|
45 | + 49 => 1, |
|
46 | + 51 => 1, |
|
47 | + 59 => 1, |
|
48 | + 61 => 1, |
|
49 | + 63 => 1, |
|
50 | + 67 => 1, |
|
51 | + 70 => 1, |
|
52 | + 71 => 1, |
|
53 | + 75 => 1, |
|
54 | + ]; |
|
55 | 55 | |
56 | - }//end getErrorList() |
|
56 | + }//end getErrorList() |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Returns the lines where warnings should occur. |
|
61 | - * |
|
62 | - * The key of the array should represent the line number and the value |
|
63 | - * should represent the number of warnings that should occur on that line. |
|
64 | - * |
|
65 | - * @return array<int, int> |
|
66 | - */ |
|
67 | - public function getWarningList() |
|
68 | - { |
|
69 | - return []; |
|
59 | + /** |
|
60 | + * Returns the lines where warnings should occur. |
|
61 | + * |
|
62 | + * The key of the array should represent the line number and the value |
|
63 | + * should represent the number of warnings that should occur on that line. |
|
64 | + * |
|
65 | + * @return array<int, int> |
|
66 | + */ |
|
67 | + public function getWarningList() |
|
68 | + { |
|
69 | + return []; |
|
70 | 70 | |
71 | - }//end getWarningList() |
|
71 | + }//end getWarningList() |
|
72 | 72 | |
73 | 73 | |
74 | 74 | }//end class |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class LanguageConstructSpacingUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class LanguageConstructSpacingUnitTest extends AbstractSniffUnitTest { |
|
16 | 15 | |
17 | 16 | |
18 | 17 | /** |
@@ -23,8 +22,7 @@ discard block |
||
23 | 22 | * |
24 | 23 | * @return array<int, int> |
25 | 24 | */ |
26 | - public function getErrorList() |
|
27 | - { |
|
25 | + public function getErrorList() { |
|
28 | 26 | return [ |
29 | 27 | 3 => 1, |
30 | 28 | 7 => 1, |
@@ -64,8 +62,7 @@ discard block |
||
64 | 62 | * |
65 | 63 | * @return array<int, int> |
66 | 64 | */ |
67 | - public function getWarningList() |
|
68 | - { |
|
65 | + public function getWarningList() { |
|
69 | 66 | return []; |
70 | 67 | |
71 | 68 | }//end getWarningList() |
@@ -64,7 +64,7 @@ |
||
64 | 64 | */ |
65 | 65 | public function getWarningList() |
66 | 66 | { |
67 | - return []; |
|
67 | + return [ ]; |
|
68 | 68 | |
69 | 69 | }//end getWarningList() |
70 | 70 |
@@ -2,16 +2,13 @@ |
||
2 | 2 | |
3 | 3 | $i = 10; |
4 | 4 | --$i; |
5 | --- $i; |
|
6 | --- /*comment*/ $i; |
|
5 | +--$i;-- /*comment*/ $i; |
|
7 | 6 | ++$i; |
8 | -++ |
|
9 | - $i; |
|
10 | -++/*comment*/$i; |
|
7 | +++$i;++/*comment*/$i; |
|
11 | 8 | |
12 | 9 | $i--; |
13 | -$i --; |
|
14 | -$i /*comment*/ --; |
|
10 | +$i--; |
|
11 | +$i /*comment*/--; |
|
12 | +$i++; |
|
15 | 13 | $i++; |
16 | -$i ++; |
|
17 | -$i /*comment*/ ++; |
|
14 | +$i /*comment*/++; |
@@ -2,40 +2,40 @@ discard block |
||
2 | 2 | <meta name="twitter:site" content="<?php echo $metaTagsData['twitter:site']; ?>"> |
3 | 3 | <?php |
4 | 4 | class Test { |
5 | - function __construct() |
|
6 | - { |
|
7 | - $this->hello(); |
|
8 | - } |
|
5 | + function __construct() |
|
6 | + { |
|
7 | + $this->hello(); |
|
8 | + } |
|
9 | 9 | |
10 | 10 | function hello() |
11 | - { |
|
12 | - echo 'hello'; |
|
11 | + { |
|
12 | + echo 'hello'; |
|
13 | 13 | }//end hello() |
14 | 14 | |
15 | - function hello2() |
|
16 | - { |
|
17 | - if (TRUE) { |
|
18 | - echo 'hello'; // no error here as its more than 4 spaces. |
|
19 | - } else { |
|
20 | - echo 'bye'; |
|
21 | - } |
|
22 | - |
|
23 | - while (TRUE) { |
|
24 | - echo 'hello'; |
|
25 | - } |
|
26 | - |
|
27 | - do { |
|
28 | - echo 'hello'; |
|
29 | - } while (TRUE); |
|
15 | + function hello2() |
|
16 | + { |
|
17 | + if (TRUE) { |
|
18 | + echo 'hello'; // no error here as its more than 4 spaces. |
|
19 | + } else { |
|
20 | + echo 'bye'; |
|
21 | + } |
|
22 | + |
|
23 | + while (TRUE) { |
|
24 | + echo 'hello'; |
|
25 | + } |
|
26 | + |
|
27 | + do { |
|
28 | + echo 'hello'; |
|
29 | + } while (TRUE); |
|
30 | 30 | } |
31 | 31 | |
32 | - function hello3() |
|
33 | - { |
|
34 | - switch ($hello) { |
|
35 | - case 'hello': |
|
36 | - break; |
|
37 | - } |
|
38 | - } |
|
32 | + function hello3() |
|
33 | + { |
|
34 | + switch ($hello) { |
|
35 | + case 'hello': |
|
36 | + break; |
|
37 | + } |
|
38 | + } |
|
39 | 39 | |
40 | 40 | } |
41 | 41 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | <body> |
46 | 46 | <?php |
47 | 47 | if ($form->validate()) { |
48 | - $safe = $form->getSubmitValues(); |
|
48 | + $safe = $form->getSubmitValues(); |
|
49 | 49 | } |
50 | 50 | ?> |
51 | 51 | </pre> |
@@ -53,62 +53,62 @@ discard block |
||
53 | 53 | |
54 | 54 | class Test2 |
55 | 55 | { |
56 | - function __construct() |
|
57 | - { |
|
58 | - // $this->open(); // error here |
|
59 | - } |
|
60 | - |
|
61 | - public function open() |
|
62 | - { |
|
63 | - // Some inline stuff that shouldn't error |
|
64 | - if (TRUE) echo 'hello'; |
|
65 | - foreach ($tokens as $token) echo $token; |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * This is a comment 1. |
|
70 | - * This is a comment 2. |
|
71 | - * This is a comment 3. |
|
72 | - * This is a comment 4. |
|
73 | - */ |
|
74 | - public function close() |
|
75 | - { |
|
76 | - // All ok. |
|
77 | - if (TRUE) { |
|
78 | - if (TRUE) { |
|
79 | - } else if (FALSE) { |
|
80 | - foreach ($tokens as $token) { |
|
81 | - switch ($token) { |
|
82 | - case '1': |
|
83 | - case '2': |
|
84 | - if (true) { |
|
85 | - if (false) { |
|
86 | - if (false) { |
|
87 | - if (false) { |
|
88 | - echo 'hello'; |
|
89 | - } |
|
90 | - } |
|
91 | - } |
|
92 | - } |
|
93 | - break; |
|
94 | - case '5': |
|
95 | - break; |
|
96 | - } |
|
97 | - do { |
|
98 | - while (true) { |
|
99 | - foreach ($tokens as $token) { |
|
100 | - for ($i = 0; $i < $token; $i++) { |
|
101 | - echo 'hello'; |
|
102 | - } |
|
103 | - } |
|
104 | - } |
|
105 | - } while (true); |
|
106 | - } |
|
107 | - } |
|
108 | - } |
|
109 | - } |
|
110 | - |
|
111 | - /* |
|
56 | + function __construct() |
|
57 | + { |
|
58 | + // $this->open(); // error here |
|
59 | + } |
|
60 | + |
|
61 | + public function open() |
|
62 | + { |
|
63 | + // Some inline stuff that shouldn't error |
|
64 | + if (TRUE) echo 'hello'; |
|
65 | + foreach ($tokens as $token) echo $token; |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * This is a comment 1. |
|
70 | + * This is a comment 2. |
|
71 | + * This is a comment 3. |
|
72 | + * This is a comment 4. |
|
73 | + */ |
|
74 | + public function close() |
|
75 | + { |
|
76 | + // All ok. |
|
77 | + if (TRUE) { |
|
78 | + if (TRUE) { |
|
79 | + } else if (FALSE) { |
|
80 | + foreach ($tokens as $token) { |
|
81 | + switch ($token) { |
|
82 | + case '1': |
|
83 | + case '2': |
|
84 | + if (true) { |
|
85 | + if (false) { |
|
86 | + if (false) { |
|
87 | + if (false) { |
|
88 | + echo 'hello'; |
|
89 | + } |
|
90 | + } |
|
91 | + } |
|
92 | + } |
|
93 | + break; |
|
94 | + case '5': |
|
95 | + break; |
|
96 | + } |
|
97 | + do { |
|
98 | + while (true) { |
|
99 | + foreach ($tokens as $token) { |
|
100 | + for ($i = 0; $i < $token; $i++) { |
|
101 | + echo 'hello'; |
|
102 | + } |
|
103 | + } |
|
104 | + } |
|
105 | + } while (true); |
|
106 | + } |
|
107 | + } |
|
108 | + } |
|
109 | + } |
|
110 | + |
|
111 | + /* |
|
112 | 112 | This is another c style comment 1. |
113 | 113 | This is another c style comment 2. |
114 | 114 | This is another c style comment 3. |
@@ -116,74 +116,74 @@ discard block |
||
116 | 116 | This is another c style comment 5. |
117 | 117 | */ |
118 | 118 | |
119 | - /* This is a T_COMMENT |
|
119 | + /* This is a T_COMMENT |
|
120 | 120 | * |
121 | 121 | * |
122 | 122 | * |
123 | 123 | */ |
124 | 124 | |
125 | - /** This is a T_DOC_COMMENT |
|
126 | - */ |
|
125 | + /** This is a T_DOC_COMMENT |
|
126 | + */ |
|
127 | 127 | |
128 | - /* |
|
128 | + /* |
|
129 | 129 | This T_COMMENT has a newline in it. |
130 | 130 | |
131 | 131 | */ |
132 | 132 | |
133 | - public function read() |
|
134 | - { |
|
135 | - echo 'hello'; |
|
133 | + public function read() |
|
134 | + { |
|
135 | + echo 'hello'; |
|
136 | 136 | |
137 | - // no errors below. |
|
138 | - $array = array( |
|
139 | - 'this', |
|
140 | - 'that' => array( |
|
141 | - 'hello', |
|
142 | - 'hello again' => array( |
|
143 | - 'hello', |
|
144 | - ), |
|
145 | - ), |
|
146 | - ); |
|
147 | - } |
|
137 | + // no errors below. |
|
138 | + $array = array( |
|
139 | + 'this', |
|
140 | + 'that' => array( |
|
141 | + 'hello', |
|
142 | + 'hello again' => array( |
|
143 | + 'hello', |
|
144 | + ), |
|
145 | + ), |
|
146 | + ); |
|
147 | + } |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | abstract class Test3 |
151 | 151 | { |
152 | - public function parse() |
|
153 | - { |
|
152 | + public function parse() |
|
153 | + { |
|
154 | 154 | |
155 | - foreach ($t as $ndx => $token) { |
|
156 | - if (is_array($token)) { |
|
157 | - echo 'here'; |
|
158 | - } else { |
|
159 | - $ts[] = array("token" => $token, "value" => ''); |
|
155 | + foreach ($t as $ndx => $token) { |
|
156 | + if (is_array($token)) { |
|
157 | + echo 'here'; |
|
158 | + } else { |
|
159 | + $ts[] = array("token" => $token, "value" => ''); |
|
160 | 160 | |
161 | - $last = count($ts) - 1; |
|
161 | + $last = count($ts) - 1; |
|
162 | 162 | |
163 | - switch ($token) { |
|
164 | - case '(': |
|
163 | + switch ($token) { |
|
164 | + case '(': |
|
165 | 165 | |
166 | - if ($last >= 3 && |
|
167 | - $ts[0]['token'] != T_CLASS && |
|
168 | - $ts[$last - 2]['token'] == T_OBJECT_OPERATOR && |
|
169 | - $ts[$last - 3]['token'] == T_VARIABLE ) { |
|
166 | + if ($last >= 3 && |
|
167 | + $ts[0]['token'] != T_CLASS && |
|
168 | + $ts[$last - 2]['token'] == T_OBJECT_OPERATOR && |
|
169 | + $ts[$last - 3]['token'] == T_VARIABLE ) { |
|
170 | 170 | |
171 | 171 | |
172 | - if (true) { |
|
173 | - echo 'hello'; |
|
174 | - } |
|
175 | - } |
|
176 | - array_push($braces, $token); |
|
177 | - break; |
|
178 | - } |
|
179 | - } |
|
180 | - } |
|
181 | - } |
|
172 | + if (true) { |
|
173 | + echo 'hello'; |
|
174 | + } |
|
175 | + } |
|
176 | + array_push($braces, $token); |
|
177 | + break; |
|
178 | + } |
|
179 | + } |
|
180 | + } |
|
181 | + } |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | function test() |
185 | 185 | { |
186 | - $o = <<<EOF |
|
186 | + $o = <<<EOF |
|
187 | 187 | this is some text |
188 | 188 | this is some text |
189 | 189 | this is some text |
@@ -192,24 +192,24 @@ discard block |
||
192 | 192 | this is some text |
193 | 193 | EOF; |
194 | 194 | |
195 | - return $o; |
|
195 | + return $o; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | if ($a === true || $a === true || $a === true || $a === true || |
199 | - $a === true || $a === true || $a === true || $a === true) { |
|
199 | + $a === true || $a === true || $a === true || $a === true) { |
|
200 | 200 | |
201 | - echo 'hello'; |
|
201 | + echo 'hello'; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | if ($true) { |
205 | - /* First comment line |
|
205 | + /* First comment line |
|
206 | 206 | * |
207 | 207 | * Comment test here |
208 | 208 | * Comment test here |
209 | 209 | * |
210 | 210 | */ |
211 | 211 | |
212 | - /* First comment line |
|
212 | + /* First comment line |
|
213 | 213 | * |
214 | 214 | * Comment test here |
215 | 215 | * Comment test here |
@@ -219,93 +219,93 @@ discard block |
||
219 | 219 | |
220 | 220 | function test() |
221 | 221 | { |
222 | - /* taken from http://de3.php.net/manual/en/reserved.php */ |
|
223 | - # $m[] = 'declare'; |
|
222 | + /* taken from http://de3.php.net/manual/en/reserved.php */ |
|
223 | + # $m[] = 'declare'; |
|
224 | 224 | /* taken from http://de3.php.net/manual/en/reserved.php */ |
225 | 225 | # $m[] = 'declare'; |
226 | 226 | } |
227 | 227 | |
228 | 228 | foreach ($elements as $element) { |
229 | - if ($something) { |
|
230 | - // Do IF. |
|
231 | - } else if ($somethingElse) { |
|
232 | - // Do ELSE. |
|
233 | - } |
|
229 | + if ($something) { |
|
230 | + // Do IF. |
|
231 | + } else if ($somethingElse) { |
|
232 | + // Do ELSE. |
|
233 | + } |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | if ($condition) { |
237 | - echo "This is a long |
|
237 | + echo "This is a long |
|
238 | 238 | string that spans $numLines lines |
239 | 239 | without indenting. |
240 | 240 | "; |
241 | 241 | } |
242 | 242 | |
243 | 243 | if ($condition) { |
244 | - echo 'This is a long |
|
244 | + echo 'This is a long |
|
245 | 245 | string that spans multiple lines |
246 | 246 | with indenting. |
247 | 247 | '; |
248 | 248 | } |
249 | 249 | |
250 | 250 | if ($condition) { |
251 | - echo 'This is a long |
|
251 | + echo 'This is a long |
|
252 | 252 | string that spans multiple lines |
253 | 253 | with indenting.'; |
254 | 254 | } |
255 | 255 | |
256 | 256 | switch ($foo) { |
257 | - case 1: |
|
258 | - switch ($bar) { |
|
259 | - default: |
|
260 | - echo $string{1}; |
|
261 | - } |
|
262 | - break; |
|
257 | + case 1: |
|
258 | + switch ($bar) { |
|
259 | + default: |
|
260 | + echo $string{1}; |
|
261 | + } |
|
262 | + break; |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | function temp($foo, $bar) { |
266 | - switch ($foo) { |
|
267 | - case 1: |
|
268 | - switch ($bar) { |
|
269 | - default: |
|
270 | - return $foo; |
|
271 | - } |
|
272 | - break; |
|
273 | - } |
|
266 | + switch ($foo) { |
|
267 | + case 1: |
|
268 | + switch ($bar) { |
|
269 | + default: |
|
270 | + return $foo; |
|
271 | + } |
|
272 | + break; |
|
273 | + } |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | switch ($foo) { |
277 | - case 1: |
|
278 | - switch ($bar) { |
|
279 | - default: |
|
280 | - if ($something) { |
|
281 | - echo $string{1}; |
|
282 | - } else if ($else) { |
|
283 | - switch ($else) { |
|
284 | - default: |
|
285 | - } |
|
286 | - } |
|
287 | - } |
|
288 | - break; |
|
277 | + case 1: |
|
278 | + switch ($bar) { |
|
279 | + default: |
|
280 | + if ($something) { |
|
281 | + echo $string{1}; |
|
282 | + } else if ($else) { |
|
283 | + switch ($else) { |
|
284 | + default: |
|
285 | + } |
|
286 | + } |
|
287 | + } |
|
288 | + break; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | switch ($name) { |
292 | - case "1": |
|
293 | - case "2": |
|
294 | - case "3": |
|
295 | - return true; |
|
292 | + case "1": |
|
293 | + case "2": |
|
294 | + case "3": |
|
295 | + return true; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | switch ($name) { |
299 | - case "1": |
|
300 | - case "2": |
|
301 | - case "3": |
|
302 | - default : |
|
303 | - return true; |
|
299 | + case "1": |
|
300 | + case "2": |
|
301 | + case "3": |
|
302 | + default : |
|
303 | + return true; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | function myFunction() |
307 | 307 | { |
308 | - ?> |
|
308 | + ?> |
|
309 | 309 | <dynamic_content> |
310 | 310 | |
311 | 311 | </dynamic_content> |
@@ -314,197 +314,197 @@ discard block |
||
314 | 314 | } |
315 | 315 | |
316 | 316 | switch ($name) { |
317 | - case "1": |
|
318 | - switch ($name2) { |
|
319 | - case "1": |
|
320 | - break; |
|
321 | - case "2": |
|
322 | - break; |
|
323 | - } |
|
324 | - break; |
|
325 | - case "2": |
|
326 | - break; |
|
317 | + case "1": |
|
318 | + switch ($name2) { |
|
319 | + case "1": |
|
320 | + break; |
|
321 | + case "2": |
|
322 | + break; |
|
323 | + } |
|
324 | + break; |
|
325 | + case "2": |
|
326 | + break; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | switch (true) { |
330 | - case true: { |
|
331 | - } |
|
332 | - echo 'hi'; |
|
333 | - break; |
|
334 | - case false: |
|
335 | - case null:{ |
|
336 | - echo 'hi'; |
|
337 | - } |
|
338 | - break; |
|
330 | + case true: { |
|
331 | + } |
|
332 | + echo 'hi'; |
|
333 | + break; |
|
334 | + case false: |
|
335 | + case null:{ |
|
336 | + echo 'hi'; |
|
337 | + } |
|
338 | + break; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | switch (true) { |
342 | - case true: { |
|
343 | - echo 'hi'; |
|
344 | - } |
|
345 | - // No break here. |
|
346 | - case false: |
|
347 | - case true: |
|
348 | - case null:{ |
|
349 | - echo 'hi'; |
|
350 | - echo 'hi'; |
|
351 | - } |
|
352 | - break; |
|
342 | + case true: { |
|
343 | + echo 'hi'; |
|
344 | + } |
|
345 | + // No break here. |
|
346 | + case false: |
|
347 | + case true: |
|
348 | + case null:{ |
|
349 | + echo 'hi'; |
|
350 | + echo 'hi'; |
|
351 | + } |
|
352 | + break; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | switch (true) { |
356 | - case true: { |
|
357 | - if (true) { |
|
358 | - echo 'hi'; |
|
359 | - } |
|
360 | - } |
|
361 | - break; |
|
356 | + case true: { |
|
357 | + if (true) { |
|
358 | + echo 'hi'; |
|
359 | + } |
|
360 | + } |
|
361 | + break; |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | // Testing anon function. |
365 | 365 | class a { |
366 | - function c() |
|
367 | - { |
|
368 | - $this->doSomething( |
|
369 | - function () { |
|
370 | - echo 123; |
|
371 | - } |
|
372 | - ); |
|
373 | - } |
|
366 | + function c() |
|
367 | + { |
|
368 | + $this->doSomething( |
|
369 | + function () { |
|
370 | + echo 123; |
|
371 | + } |
|
372 | + ); |
|
373 | + } |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | some_function( |
377 | - function() { |
|
378 | - $a = 403; |
|
379 | - if ($a === 404) { |
|
380 | - $a = 403; |
|
381 | - } |
|
382 | - } |
|
377 | + function() { |
|
378 | + $a = 403; |
|
379 | + if ($a === 404) { |
|
380 | + $a = 403; |
|
381 | + } |
|
382 | + } |
|
383 | 383 | ); |
384 | 384 | |
385 | 385 | some_function( |
386 | 386 | function() { |
387 | - $a = 403; |
|
388 | - if ($a === 404) { |
|
389 | - $a = 403; |
|
390 | - } |
|
391 | - } |
|
387 | + $a = 403; |
|
388 | + if ($a === 404) { |
|
389 | + $a = 403; |
|
390 | + } |
|
391 | + } |
|
392 | 392 | ); |
393 | 393 | |
394 | 394 | $myFunction = function() { |
395 | - $a = 403; |
|
396 | - if ($a === 404) { |
|
397 | - $a = 403; |
|
398 | - } |
|
395 | + $a = 403; |
|
396 | + if ($a === 404) { |
|
397 | + $a = 403; |
|
398 | + } |
|
399 | 399 | }; |
400 | 400 | |
401 | 401 | class Whatever |
402 | 402 | { |
403 | - protected $_protectedArray = array( |
|
404 | - 'normalString' => 'That email address is already in use!', |
|
405 | - 'offendingString' => <<<'STRING' |
|
403 | + protected $_protectedArray = array( |
|
404 | + 'normalString' => 'That email address is already in use!', |
|
405 | + 'offendingString' => <<<'STRING' |
|
406 | 406 | Each line of this string is always said to be at column 0, |
407 | 407 | no matter how many spaces are placed |
408 | 408 | at the beginning of each line |
409 | 409 | and the ending STRING on the next line is reported as having to be indented. |
410 | 410 | STRING |
411 | - ); |
|
411 | + ); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | class MyClass |
415 | 415 | { |
416 | - public static function myFunction() |
|
417 | - { |
|
418 | - if (empty($keywords) === FALSE) { |
|
419 | - $keywords = 'foo'; |
|
420 | - $existing = 'foo'; |
|
421 | - } |
|
416 | + public static function myFunction() |
|
417 | + { |
|
418 | + if (empty($keywords) === FALSE) { |
|
419 | + $keywords = 'foo'; |
|
420 | + $existing = 'foo'; |
|
421 | + } |
|
422 | 422 | |
423 | - return $keywords; |
|
423 | + return $keywords; |
|
424 | 424 | |
425 | - }//end myFunction() |
|
425 | + }//end myFunction() |
|
426 | 426 | |
427 | 427 | }//end class |
428 | 428 | |
429 | 429 | $var = call_user_func( |
430 | - $new_var = function () use (&$a) { |
|
431 | - if ($a > 0) { |
|
432 | - return $a++; |
|
433 | - } else { |
|
434 | - return $a--; |
|
435 | - } |
|
436 | - } |
|
430 | + $new_var = function () use (&$a) { |
|
431 | + if ($a > 0) { |
|
432 | + return $a++; |
|
433 | + } else { |
|
434 | + return $a--; |
|
435 | + } |
|
436 | + } |
|
437 | 437 | ); |
438 | 438 | |
439 | 439 | class AnonymousFn |
440 | 440 | { |
441 | - public function getAnonFn() |
|
442 | - { |
|
443 | - return array( |
|
444 | - 'functions' => Array( |
|
445 | - 'function1' => function ($a, $b, $c) { |
|
446 | - $a = $b + $c; |
|
447 | - $b = $c / 2; |
|
448 | - return Array($a, $b, $c); |
|
449 | - }, |
|
450 | - ), |
|
451 | - ); |
|
452 | - } |
|
441 | + public function getAnonFn() |
|
442 | + { |
|
443 | + return array( |
|
444 | + 'functions' => Array( |
|
445 | + 'function1' => function ($a, $b, $c) { |
|
446 | + $a = $b + $c; |
|
447 | + $b = $c / 2; |
|
448 | + return Array($a, $b, $c); |
|
449 | + }, |
|
450 | + ), |
|
451 | + ); |
|
452 | + } |
|
453 | 453 | } |
454 | 454 | ?> |
455 | 455 | |
456 | 456 | <div> |
457 | 457 | <?php |
458 | - if ($myvar == 'test') { |
|
459 | - echo 'something'; |
|
460 | - } |
|
461 | - ?> |
|
458 | + if ($myvar == 'test') { |
|
459 | + echo 'something'; |
|
460 | + } |
|
461 | + ?> |
|
462 | 462 | <div> |
463 | 463 | <div> |
464 | 464 | <?php |
465 | - if ($myvar == 'test') { |
|
466 | - echo 'something'; |
|
467 | - } |
|
468 | - ?> |
|
465 | + if ($myvar == 'test') { |
|
466 | + echo 'something'; |
|
467 | + } |
|
468 | + ?> |
|
469 | 469 | <div> |
470 | 470 | <div> |
471 | 471 | <?php |
472 | 472 | if ($myvar == 'test') { |
473 | - echo 'something'; |
|
473 | + echo 'something'; |
|
474 | 474 | } |
475 | - ?> |
|
475 | + ?> |
|
476 | 476 | <div> |
477 | 477 | <body> |
478 | 478 | <?php |
479 | - if (isset($_GET["test"])) { |
|
480 | - if ($_GET["test"] <> "") { |
|
481 | - $test = true; |
|
482 | - } else { |
|
483 | - $test = true; |
|
484 | - } |
|
485 | - } |
|
486 | - ?> |
|
479 | + if (isset($_GET["test"])) { |
|
480 | + if ($_GET["test"] <> "") { |
|
481 | + $test = true; |
|
482 | + } else { |
|
483 | + $test = true; |
|
484 | + } |
|
485 | + } |
|
486 | + ?> |
|
487 | 487 | </body> |
488 | 488 | |
489 | 489 | <?php |
490 | 490 | if (true) { |
491 | - ?> |
|
491 | + ?> |
|
492 | 492 | <div> |
493 | 493 | <div> |
494 | 494 | <div> |
495 | 495 | <?php |
496 | - if (true) { |
|
497 | - echo 'hello'; |
|
498 | - } else { |
|
499 | - echo 'goodbye'; |
|
500 | - } |
|
501 | - ?> |
|
496 | + if (true) { |
|
497 | + echo 'hello'; |
|
498 | + } else { |
|
499 | + echo 'goodbye'; |
|
500 | + } |
|
501 | + ?> |
|
502 | 502 | </div> |
503 | 503 | </div> |
504 | 504 | </div> |
505 | 505 | <?php |
506 | 506 | } else { |
507 | - echo 'else'; |
|
507 | + echo 'else'; |
|
508 | 508 | } |
509 | 509 | ?> |
510 | 510 | <?php if (isset($param)) { ?> |
@@ -512,49 +512,49 @@ discard block |
||
512 | 512 | <?php } |
513 | 513 | |
514 | 514 | $list = [ |
515 | - 'fn' => function ($a) { |
|
516 | - if ($a === true) { |
|
517 | - echo 'hi'; |
|
518 | - } |
|
519 | - } |
|
515 | + 'fn' => function ($a) { |
|
516 | + if ($a === true) { |
|
517 | + echo 'hi'; |
|
518 | + } |
|
519 | + } |
|
520 | 520 | ]; |
521 | 521 | |
522 | 522 | $list = [ |
523 | - 'fn' => function ($a) { |
|
524 | - if ($a === true) { |
|
525 | - echo 'hi'; |
|
526 | - } |
|
527 | - } |
|
523 | + 'fn' => function ($a) { |
|
524 | + if ($a === true) { |
|
525 | + echo 'hi'; |
|
526 | + } |
|
527 | + } |
|
528 | 528 | ]; |
529 | 529 | |
530 | 530 | if ($foo) { |
531 | - foreach ($bar as $baz) { |
|
532 | - if ($baz) { |
|
533 | - ?> |
|
531 | + foreach ($bar as $baz) { |
|
532 | + if ($baz) { |
|
533 | + ?> |
|
534 | 534 | <div> |
535 | 535 | <div> |
536 | 536 | <div> |
537 | 537 | <?php |
538 | - if ($baz > 1) { |
|
539 | - echo '1'; |
|
540 | - } |
|
541 | - ?> |
|
538 | + if ($baz > 1) { |
|
539 | + echo '1'; |
|
540 | + } |
|
541 | + ?> |
|
542 | 542 | </div> |
543 | 543 | <?php |
544 | - if ($baz > 1) { |
|
545 | - echo '1'; |
|
546 | - } |
|
547 | - ?> |
|
544 | + if ($baz > 1) { |
|
545 | + echo '1'; |
|
546 | + } |
|
547 | + ?> |
|
548 | 548 | </div> |
549 | 549 | <?php |
550 | - if ($baz > 1) { |
|
551 | - echo '1'; |
|
552 | - } |
|
553 | - ?> |
|
550 | + if ($baz > 1) { |
|
551 | + echo '1'; |
|
552 | + } |
|
553 | + ?> |
|
554 | 554 | </div> |
555 | 555 | <?php |
556 | - } |
|
557 | - } |
|
556 | + } |
|
557 | + } |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | ?> |
@@ -562,98 +562,98 @@ discard block |
||
562 | 562 | |
563 | 563 | <?php |
564 | 564 | if ($foo) { |
565 | - echo '1'; |
|
566 | - echo '2'; |
|
567 | - echo '3'; |
|
565 | + echo '1'; |
|
566 | + echo '2'; |
|
567 | + echo '3'; |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | $array = array(); |
571 | 571 | array_map( |
572 | - function($x) |
|
573 | - { |
|
574 | - return trim($x); |
|
575 | - }, |
|
576 | - $array |
|
572 | + function($x) |
|
573 | + { |
|
574 | + return trim($x); |
|
575 | + }, |
|
576 | + $array |
|
577 | 577 | ); |
578 | 578 | |
579 | 579 | function foo(){return function(){};} |
580 | 580 | |
581 | 581 | $mockedDatabase->expects($this->at(2)) |
582 | - ->with($this->callback( |
|
583 | - function ($subject) |
|
584 | - { |
|
585 | - } |
|
586 | - ) |
|
587 | - ); |
|
582 | + ->with($this->callback( |
|
583 | + function ($subject) |
|
584 | + { |
|
585 | + } |
|
586 | + ) |
|
587 | + ); |
|
588 | 588 | |
589 | 589 | /** @var Database $mockedDatabase */ |
590 | 590 | /** @var Container $mockedContainer */ |
591 | 591 | |
592 | 592 | echo $string->append('foo') |
593 | - ->appaend('bar') |
|
594 | - ->appaend('baz') |
|
595 | - ->outputUsing( |
|
596 | - function () |
|
597 | - { |
|
598 | - } |
|
599 | - ); |
|
593 | + ->appaend('bar') |
|
594 | + ->appaend('baz') |
|
595 | + ->outputUsing( |
|
596 | + function () |
|
597 | + { |
|
598 | + } |
|
599 | + ); |
|
600 | 600 | |
601 | 601 | echo PHP_EOL; |
602 | 602 | |
603 | 603 | switch ($arg) { |
604 | - case 1: |
|
605 | - break; |
|
606 | - case 2: |
|
607 | - if ($arg2 == 'foo') { |
|
608 | - } |
|
609 | - case 3: |
|
610 | - default: |
|
611 | - echo 'default'; |
|
604 | + case 1: |
|
605 | + break; |
|
606 | + case 2: |
|
607 | + if ($arg2 == 'foo') { |
|
608 | + } |
|
609 | + case 3: |
|
610 | + default: |
|
611 | + echo 'default'; |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | if ($tokens[$stackPtr]['content']{0} === '#') { |
615 | 615 | } else if ($tokens[$stackPtr]['content']{0} === '/' |
616 | - && $tokens[$stackPtr]['content']{1} === '/' |
|
616 | + && $tokens[$stackPtr]['content']{1} === '/' |
|
617 | 617 | ) { |
618 | 618 | } |
619 | 619 | |
620 | 620 | $var = call_user_func( |
621 | - function() { |
|
622 | - if ($foo) { |
|
623 | - $new_var = function() { |
|
624 | - if ($a > 0) { |
|
625 | - return $a++; |
|
626 | - } else { |
|
627 | - return $a--; |
|
628 | - } |
|
629 | - }; |
|
630 | - } |
|
631 | - } |
|
621 | + function() { |
|
622 | + if ($foo) { |
|
623 | + $new_var = function() { |
|
624 | + if ($a > 0) { |
|
625 | + return $a++; |
|
626 | + } else { |
|
627 | + return $a--; |
|
628 | + } |
|
629 | + }; |
|
630 | + } |
|
631 | + } |
|
632 | 632 | ); |
633 | 633 | |
634 | 634 | a( |
635 | - function() { |
|
636 | - $a = function() { |
|
637 | - $b = false; |
|
638 | - }; |
|
639 | - true; |
|
640 | - } |
|
635 | + function() { |
|
636 | + $a = function() { |
|
637 | + $b = false; |
|
638 | + }; |
|
639 | + true; |
|
640 | + } |
|
641 | 641 | ); |
642 | 642 | |
643 | 643 | $var = [ |
644 | - [ |
|
645 | - '1' => |
|
646 | - function () { |
|
647 | - return true; |
|
648 | - }, |
|
649 | - ], |
|
650 | - [ |
|
651 | - '1' => |
|
652 | - function () { |
|
653 | - return true; |
|
654 | - }, |
|
655 | - '2' => true, |
|
656 | - ] |
|
644 | + [ |
|
645 | + '1' => |
|
646 | + function () { |
|
647 | + return true; |
|
648 | + }, |
|
649 | + ], |
|
650 | + [ |
|
651 | + '1' => |
|
652 | + function () { |
|
653 | + return true; |
|
654 | + }, |
|
655 | + '2' => true, |
|
656 | + ] |
|
657 | 657 | ]; |
658 | 658 | |
659 | 659 | if ($foo) { |
@@ -664,138 +664,138 @@ discard block |
||
664 | 664 | |
665 | 665 | function foo() |
666 | 666 | { |
667 | - $failingTests[$testName][] = array( |
|
668 | - 'comment' => self::_replaceKeywords($failingComment, $result), |
|
669 | - 'screenshot' => Test::getScreenshotPath( |
|
670 | - $projectid, |
|
671 | - $result['class_name'], |
|
672 | - ), |
|
673 | - ); |
|
667 | + $failingTests[$testName][] = array( |
|
668 | + 'comment' => self::_replaceKeywords($failingComment, $result), |
|
669 | + 'screenshot' => Test::getScreenshotPath( |
|
670 | + $projectid, |
|
671 | + $result['class_name'], |
|
672 | + ), |
|
673 | + ); |
|
674 | 674 | |
675 | 675 | } |
676 | 676 | |
677 | 677 | $this->mockedDatabase |
678 | - ->with( |
|
679 | - $this->callback( |
|
680 | - function () { |
|
681 | - return; |
|
682 | - } |
|
683 | - ) |
|
684 | - ); |
|
678 | + ->with( |
|
679 | + $this->callback( |
|
680 | + function () { |
|
681 | + return; |
|
682 | + } |
|
683 | + ) |
|
684 | + ); |
|
685 | 685 | |
686 | 686 | $this->subject->recordLogin(); |
687 | 687 | |
688 | 688 | function a() |
689 | 689 | { |
690 | - if (true) { |
|
691 | - static::$a[$b] = |
|
692 | - static::where($c) |
|
693 | - ->where($c) |
|
694 | - ->where( |
|
695 | - function ($d) { |
|
696 | - $d->whereNull(); |
|
697 | - $d->orWhere(); |
|
698 | - } |
|
699 | - ) |
|
700 | - ->first(); |
|
701 | - |
|
702 | - if (static::$a[$b] === null) { |
|
703 | - static::$a[$b] = new static( |
|
704 | - array( |
|
705 | - 'a' => $a->id, |
|
706 | - 'a' => $a->id, |
|
707 | - ) |
|
708 | - ); |
|
709 | - } |
|
710 | - } |
|
711 | - |
|
712 | - return static::$a[$b]; |
|
690 | + if (true) { |
|
691 | + static::$a[$b] = |
|
692 | + static::where($c) |
|
693 | + ->where($c) |
|
694 | + ->where( |
|
695 | + function ($d) { |
|
696 | + $d->whereNull(); |
|
697 | + $d->orWhere(); |
|
698 | + } |
|
699 | + ) |
|
700 | + ->first(); |
|
701 | + |
|
702 | + if (static::$a[$b] === null) { |
|
703 | + static::$a[$b] = new static( |
|
704 | + array( |
|
705 | + 'a' => $a->id, |
|
706 | + 'a' => $a->id, |
|
707 | + ) |
|
708 | + ); |
|
709 | + } |
|
710 | + } |
|
711 | + |
|
712 | + return static::$a[$b]; |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | $foo->load( |
716 | - array( |
|
717 | - 'bar' => function ($baz) { |
|
718 | - $baz->call(); |
|
719 | - } |
|
720 | - ) |
|
716 | + array( |
|
717 | + 'bar' => function ($baz) { |
|
718 | + $baz->call(); |
|
719 | + } |
|
720 | + ) |
|
721 | 721 | ); |
722 | 722 | |
723 | 723 | hello(); |
724 | 724 | |
725 | 725 | $foo = array_unique( |
726 | - array_map( |
|
727 | - function ($entry) { |
|
728 | - return $entry * 2; |
|
729 | - }, |
|
730 | - array() |
|
731 | - ) |
|
726 | + array_map( |
|
727 | + function ($entry) { |
|
728 | + return $entry * 2; |
|
729 | + }, |
|
730 | + array() |
|
731 | + ) |
|
732 | 732 | ); |
733 | 733 | bar($foo); |
734 | 734 | |
735 | 735 | class PHP_CodeSniffer_Tokenizers_JS |
736 | 736 | { |
737 | 737 | |
738 | - public $scopeOpeners = array( |
|
739 | - T_CASE => array( |
|
740 | - 'end' => array( |
|
741 | - T_BREAK => T_BREAK, |
|
742 | - T_RETURN => T_RETURN, |
|
743 | - ), |
|
744 | - 'strict' => true, |
|
745 | - ), |
|
746 | - ); |
|
738 | + public $scopeOpeners = array( |
|
739 | + T_CASE => array( |
|
740 | + 'end' => array( |
|
741 | + T_BREAK => T_BREAK, |
|
742 | + T_RETURN => T_RETURN, |
|
743 | + ), |
|
744 | + 'strict' => true, |
|
745 | + ), |
|
746 | + ); |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | echo $string-> |
750 | - append('foo')-> |
|
751 | - appaend('bar')-> |
|
752 | - appaend('baz')-> |
|
753 | - outputUsing( |
|
754 | - function () |
|
755 | - { |
|
756 | - } |
|
757 | - ); |
|
750 | + append('foo')-> |
|
751 | + appaend('bar')-> |
|
752 | + appaend('baz')-> |
|
753 | + outputUsing( |
|
754 | + function () |
|
755 | + { |
|
756 | + } |
|
757 | + ); |
|
758 | 758 | |
759 | 759 | $str = 'the items I want to show are: ' . |
760 | - implode( |
|
761 | - ', ', |
|
762 | - array('a', 'b', 'c') |
|
763 | - ); |
|
760 | + implode( |
|
761 | + ', ', |
|
762 | + array('a', 'b', 'c') |
|
763 | + ); |
|
764 | 764 | |
765 | 765 | echo $str; |
766 | 766 | |
767 | 767 | $str = 'foo' |
768 | - . '1' |
|
769 | - . '2'; |
|
768 | + . '1' |
|
769 | + . '2'; |
|
770 | 770 | |
771 | 771 | echo $str; |
772 | 772 | |
773 | 773 | bar([ |
774 | - 'foo' => foo(function () { |
|
775 | - return 'foo'; |
|
776 | - }) |
|
774 | + 'foo' => foo(function () { |
|
775 | + return 'foo'; |
|
776 | + }) |
|
777 | 777 | ]); |
778 | 778 | |
779 | 779 | $domains = array_unique( |
780 | - array_map( |
|
781 | - function ($url) { |
|
782 | - $urlObject = new \Purl\Url($url); |
|
783 | - return $urlObject->registerableDomain; |
|
784 | - }, |
|
785 | - $sites |
|
786 | - ) |
|
780 | + array_map( |
|
781 | + function ($url) { |
|
782 | + $urlObject = new \Purl\Url($url); |
|
783 | + return $urlObject->registerableDomain; |
|
784 | + }, |
|
785 | + $sites |
|
786 | + ) |
|
787 | 787 | ); |
788 | 788 | |
789 | 789 | return $domains; |
790 | 790 | |
791 | 791 | if ($a == 5) : |
792 | - echo "a equals 5"; |
|
793 | - echo "..."; |
|
792 | + echo "a equals 5"; |
|
793 | + echo "..."; |
|
794 | 794 | elseif ($a == 6) : |
795 | - echo "a equals 6"; |
|
796 | - echo "!!!"; |
|
795 | + echo "a equals 6"; |
|
796 | + echo "!!!"; |
|
797 | 797 | else : |
798 | - echo "a is neither 5 nor 6"; |
|
798 | + echo "a is neither 5 nor 6"; |
|
799 | 799 | endif; |
800 | 800 | |
801 | 801 | if ($foo): |
@@ -804,74 +804,74 @@ discard block |
||
804 | 804 | endif; |
805 | 805 | |
806 | 806 | $this |
807 | - ->method(array( |
|
808 | - 'foo' => 'bar', |
|
809 | - ), 'arg', array( |
|
810 | - 'foo' => 'bar', |
|
811 | - )); |
|
807 | + ->method(array( |
|
808 | + 'foo' => 'bar', |
|
809 | + ), 'arg', array( |
|
810 | + 'foo' => 'bar', |
|
811 | + )); |
|
812 | 812 | |
813 | 813 | class Foo |
814 | 814 | { |
815 | - use Bar { |
|
816 | - myMethod as renamedMethod; |
|
817 | - } |
|
815 | + use Bar { |
|
816 | + myMethod as renamedMethod; |
|
817 | + } |
|
818 | 818 | } |
819 | 819 | |
820 | 820 | class Foo |
821 | 821 | { |
822 | - use Bar { |
|
823 | - myMethod as renamedMethod; |
|
824 | - } |
|
822 | + use Bar { |
|
823 | + myMethod as renamedMethod; |
|
824 | + } |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | foo(); |
828 | 828 | |
829 | 829 | array( |
830 | 830 | 'key1' => function ($bar) { |
831 | - return $bar; |
|
831 | + return $bar; |
|
832 | 832 | }, |
833 | 833 | 'key2' => function ($foo) { |
834 | - return $foo; |
|
834 | + return $foo; |
|
835 | 835 | }, |
836 | 836 | ); |
837 | 837 | |
838 | 838 | ?> |
839 | 839 | <script> |
840 | 840 | var foo = <?php echo bar( |
841 | - 'baz' |
|
842 | - ); ?>; |
|
841 | + 'baz' |
|
842 | + ); ?>; |
|
843 | 843 | </script> |
844 | 844 | <?php |
845 | 845 | |
846 | 846 | try { |
847 | - echo 'foo'; |
|
847 | + echo 'foo'; |
|
848 | 848 | } catch (\Exception $e) { |
849 | - echo 'catch'; |
|
849 | + echo 'catch'; |
|
850 | 850 | } finally { |
851 | - if (false) { |
|
852 | - echo 'finally false'; |
|
853 | - } |
|
851 | + if (false) { |
|
852 | + echo 'finally false'; |
|
853 | + } |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | class C0 |
857 | 857 | { |
858 | - public function m0() |
|
859 | - { |
|
860 | - } |
|
858 | + public function m0() |
|
859 | + { |
|
860 | + } |
|
861 | 861 | |
862 | - public function m1() |
|
863 | - { |
|
864 | - } |
|
862 | + public function m1() |
|
863 | + { |
|
864 | + } |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | namespace Foo { |
868 | 868 | |
869 | - use \Foo\Bar; |
|
870 | - use \Foo\Baz; |
|
869 | + use \Foo\Bar; |
|
870 | + use \Foo\Baz; |
|
871 | 871 | |
872 | - function test() { |
|
873 | - return true; |
|
874 | - } |
|
872 | + function test() { |
|
873 | + return true; |
|
874 | + } |
|
875 | 875 | |
876 | 876 | } |
877 | 877 | |
@@ -880,183 +880,183 @@ discard block |
||
880 | 880 | } |
881 | 881 | |
882 | 882 | $a = |
883 | - ( |
|
884 | - $b = 1 |
|
885 | - ); |
|
883 | + ( |
|
884 | + $b = 1 |
|
885 | + ); |
|
886 | 886 | $c = 2; |
887 | 887 | |
888 | 888 | $a = |
889 | - [ |
|
890 | - $b => 1, |
|
891 | - ]; |
|
889 | + [ |
|
890 | + $b => 1, |
|
891 | + ]; |
|
892 | 892 | $c = 2; |
893 | 893 | |
894 | 894 | class foo |
895 | 895 | { |
896 | - public function get() |
|
897 | - { |
|
898 | - $foo = ['b' => 'c', |
|
899 | - 'd' => [ |
|
900 | - ['e' => 'f'] |
|
901 | - ]]; |
|
902 | - echo '42'; |
|
903 | - |
|
904 | - $foo = array('b' => 'c', |
|
905 | - 'd' => array( |
|
906 | - array('e' => 'f') |
|
907 | - )); |
|
908 | - echo '42'; |
|
909 | - } |
|
896 | + public function get() |
|
897 | + { |
|
898 | + $foo = ['b' => 'c', |
|
899 | + 'd' => [ |
|
900 | + ['e' => 'f'] |
|
901 | + ]]; |
|
902 | + echo '42'; |
|
903 | + |
|
904 | + $foo = array('b' => 'c', |
|
905 | + 'd' => array( |
|
906 | + array('e' => 'f') |
|
907 | + )); |
|
908 | + echo '42'; |
|
909 | + } |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | switch ($foo) { |
913 | - case 1: |
|
914 | - return array(); |
|
915 | - case 2: |
|
916 | - return ''; |
|
917 | - case 3: |
|
918 | - return $function(); |
|
919 | - case 4: |
|
920 | - return $functionCall($param[0]); |
|
921 | - case 5: |
|
922 | - return array() + array(); // Array Merge |
|
923 | - case 6: |
|
924 | - // String connect |
|
925 | - return $functionReturningString('') . $functionReturningString(array()); |
|
926 | - case 7: |
|
927 | - return functionCall( |
|
928 | - $withMultiLineParam[0], |
|
929 | - array(), |
|
930 | - $functionReturningString( |
|
931 | - $withMultiLineParam[1] |
|
932 | - ) |
|
933 | - ); |
|
934 | - case 8: |
|
935 | - return $param[0][0]; |
|
913 | + case 1: |
|
914 | + return array(); |
|
915 | + case 2: |
|
916 | + return ''; |
|
917 | + case 3: |
|
918 | + return $function(); |
|
919 | + case 4: |
|
920 | + return $functionCall($param[0]); |
|
921 | + case 5: |
|
922 | + return array() + array(); // Array Merge |
|
923 | + case 6: |
|
924 | + // String connect |
|
925 | + return $functionReturningString('') . $functionReturningString(array()); |
|
926 | + case 7: |
|
927 | + return functionCall( |
|
928 | + $withMultiLineParam[0], |
|
929 | + array(), |
|
930 | + $functionReturningString( |
|
931 | + $withMultiLineParam[1] |
|
932 | + ) |
|
933 | + ); |
|
934 | + case 8: |
|
935 | + return $param[0][0]; |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | class Test { |
939 | 939 | |
940 | - public |
|
941 | - $foo |
|
942 | - ,$bar |
|
943 | - ,$baz = [ ] |
|
944 | - ; |
|
940 | + public |
|
941 | + $foo |
|
942 | + ,$bar |
|
943 | + ,$baz = [ ] |
|
944 | + ; |
|
945 | 945 | |
946 | - public function wtfindent() { |
|
947 | - } |
|
946 | + public function wtfindent() { |
|
947 | + } |
|
948 | 948 | } |
949 | 949 | |
950 | 950 | switch ($x) { |
951 | - case 1: |
|
952 | - return [1]; |
|
953 | - default: |
|
954 | - return [2]; |
|
951 | + case 1: |
|
952 | + return [1]; |
|
953 | + default: |
|
954 | + return [2]; |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | switch ($foo) { |
958 | - case self::FOO: |
|
959 | - return $this->bar($gfoo, function ($id) { |
|
960 | - return FOO::bar($id); |
|
961 | - }, $values); |
|
962 | - case self::BAR: |
|
963 | - $values = $this->bar($foo, $values); |
|
964 | - break; |
|
958 | + case self::FOO: |
|
959 | + return $this->bar($gfoo, function ($id) { |
|
960 | + return FOO::bar($id); |
|
961 | + }, $values); |
|
962 | + case self::BAR: |
|
963 | + $values = $this->bar($foo, $values); |
|
964 | + break; |
|
965 | 965 | } |
966 | 966 | |
967 | 967 | $var = array( |
968 | - 'long description' => |
|
969 | - array(0, 'something'), |
|
970 | - 'another long description' => |
|
971 | - array(1, "something else") |
|
968 | + 'long description' => |
|
969 | + array(0, 'something'), |
|
970 | + 'another long description' => |
|
971 | + array(1, "something else") |
|
972 | 972 | ); |
973 | 973 | |
974 | 974 | $services = array( |
975 | - 'service 1' => |
|
976 | - Mockery::mock('class 1') |
|
977 | - ->shouldReceive('setFilter')->once() |
|
978 | - ->shouldReceive('getNbResults')->atLeast()->once() |
|
979 | - ->shouldReceive('getSlice')->once()->andReturn(array()) |
|
980 | - ->getMock(), |
|
981 | - 'service 2' => |
|
982 | - Mockery::mock('class 2') |
|
983 | - ->shouldReceive('__invoke')->once() |
|
984 | - ->getMock() |
|
975 | + 'service 1' => |
|
976 | + Mockery::mock('class 1') |
|
977 | + ->shouldReceive('setFilter')->once() |
|
978 | + ->shouldReceive('getNbResults')->atLeast()->once() |
|
979 | + ->shouldReceive('getSlice')->once()->andReturn(array()) |
|
980 | + ->getMock(), |
|
981 | + 'service 2' => |
|
982 | + Mockery::mock('class 2') |
|
983 | + ->shouldReceive('__invoke')->once() |
|
984 | + ->getMock() |
|
985 | 985 | ); |
986 | 986 | |
987 | 987 | class Foo |
988 | 988 | { |
989 | - public function setUp() |
|
990 | - { |
|
991 | - $this->foo = new class { |
|
992 | - public $name = 'Some value'; |
|
993 | - }; |
|
994 | - } |
|
989 | + public function setUp() |
|
990 | + { |
|
991 | + $this->foo = new class { |
|
992 | + public $name = 'Some value'; |
|
993 | + }; |
|
994 | + } |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | try { |
998 | - foo(); |
|
998 | + foo(); |
|
999 | 999 | } catch (\Exception $e) { |
1000 | - $foo = function() { |
|
1001 | - return 'foo'; |
|
1002 | - }; |
|
1000 | + $foo = function() { |
|
1001 | + return 'foo'; |
|
1002 | + }; |
|
1003 | 1003 | |
1004 | - if (true) { |
|
1005 | - } |
|
1004 | + if (true) { |
|
1005 | + } |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | if ($foo) { |
1009 | - foo(); |
|
1009 | + foo(); |
|
1010 | 1010 | } else if ($e) { |
1011 | - $foo = function() { |
|
1012 | - return 'foo'; |
|
1013 | - }; |
|
1011 | + $foo = function() { |
|
1012 | + return 'foo'; |
|
1013 | + }; |
|
1014 | 1014 | |
1015 | - if (true) { |
|
1016 | - } |
|
1015 | + if (true) { |
|
1016 | + } |
|
1017 | 1017 | } else { |
1018 | - $foo = function() { |
|
1019 | - return 'foo'; |
|
1020 | - }; |
|
1018 | + $foo = function() { |
|
1019 | + return 'foo'; |
|
1020 | + }; |
|
1021 | 1021 | |
1022 | - if (true) { |
|
1023 | - } |
|
1022 | + if (true) { |
|
1023 | + } |
|
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | switch ($parameter) { |
1027 | - case null: |
|
1028 | - return [ |
|
1029 | - 'foo' => in_array( |
|
1030 | - 'foo', |
|
1031 | - [] |
|
1032 | - ), |
|
1033 | - ]; |
|
1027 | + case null: |
|
1028 | + return [ |
|
1029 | + 'foo' => in_array( |
|
1030 | + 'foo', |
|
1031 | + [] |
|
1032 | + ), |
|
1033 | + ]; |
|
1034 | 1034 | |
1035 | - default: |
|
1036 | - return []; |
|
1035 | + default: |
|
1036 | + return []; |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | class SomeClass |
1040 | 1040 | { |
1041 | - public function someFunc() |
|
1042 | - { |
|
1043 | - a(function () { |
|
1044 | - echo "a"; |
|
1045 | - })->b(function () { |
|
1046 | - echo "b"; |
|
1047 | - }); |
|
1041 | + public function someFunc() |
|
1042 | + { |
|
1043 | + a(function () { |
|
1044 | + echo "a"; |
|
1045 | + })->b(function () { |
|
1046 | + echo "b"; |
|
1047 | + }); |
|
1048 | 1048 | |
1049 | - if (true) { |
|
1050 | - echo "c"; |
|
1051 | - } |
|
1052 | - echo "d"; |
|
1053 | - } |
|
1049 | + if (true) { |
|
1050 | + echo "c"; |
|
1051 | + } |
|
1052 | + echo "d"; |
|
1053 | + } |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | $params = self::validate_parameters(self::read_competency_framework_parameters(), |
1057 | - array( |
|
1058 | - 'id' => $id, |
|
1059 | - )); |
|
1057 | + array( |
|
1058 | + 'id' => $id, |
|
1059 | + )); |
|
1060 | 1060 | |
1061 | 1061 | $framework = api::read_framework($params['id']); |
1062 | 1062 | self::validate_context($framework->get_context()); |
@@ -1064,354 +1064,354 @@ discard block |
||
1064 | 1064 | |
1065 | 1065 | class Test123 |
1066 | 1066 | { |
1067 | - protected static |
|
1068 | - $prop1 = [ |
|
1069 | - 'testA' => 123, |
|
1070 | - ], |
|
1071 | - $prop2 = [ |
|
1072 | - 'testB' => 456, |
|
1073 | - ]; |
|
1067 | + protected static |
|
1068 | + $prop1 = [ |
|
1069 | + 'testA' => 123, |
|
1070 | + ], |
|
1071 | + $prop2 = [ |
|
1072 | + 'testB' => 456, |
|
1073 | + ]; |
|
1074 | 1074 | |
1075 | - protected static |
|
1076 | - $prop3 = array( |
|
1077 | - 'testA' => 123, |
|
1078 | - ), |
|
1079 | - $prop4 = array( |
|
1080 | - 'testB' => 456, |
|
1081 | - ); |
|
1075 | + protected static |
|
1076 | + $prop3 = array( |
|
1077 | + 'testA' => 123, |
|
1078 | + ), |
|
1079 | + $prop4 = array( |
|
1080 | + 'testB' => 456, |
|
1081 | + ); |
|
1082 | 1082 | |
1083 | - protected static $prop5; |
|
1083 | + protected static $prop5; |
|
1084 | 1084 | } |
1085 | 1085 | |
1086 | 1086 | $foo = foo( |
1087 | - function () { |
|
1088 | - $foo->debug( |
|
1089 | - $a, |
|
1090 | - $b |
|
1091 | - ); |
|
1092 | - |
|
1093 | - if ($a) { |
|
1094 | - $b = $a; |
|
1095 | - } |
|
1096 | - } |
|
1087 | + function () { |
|
1088 | + $foo->debug( |
|
1089 | + $a, |
|
1090 | + $b |
|
1091 | + ); |
|
1092 | + |
|
1093 | + if ($a) { |
|
1094 | + $b = $a; |
|
1095 | + } |
|
1096 | + } |
|
1097 | 1097 | ); |
1098 | 1098 | |
1099 | 1099 | if (somethingIsTrue()) { |
1100 | - ?> |
|
1100 | + ?> |
|
1101 | 1101 | <div> |
1102 | 1102 | <?php |
1103 | - $someVar = doSomething( |
|
1104 | - 'foobar', |
|
1105 | - true, |
|
1106 | - 'foo', |
|
1107 | - 'bar' |
|
1108 | - ); |
|
1109 | - |
|
1110 | - if (somethingElseIsTrue()) { |
|
1111 | - doOneThing(); |
|
1112 | - } else { |
|
1113 | - doTheOtherThing(); |
|
1114 | - } |
|
1115 | - ?> |
|
1103 | + $someVar = doSomething( |
|
1104 | + 'foobar', |
|
1105 | + true, |
|
1106 | + 'foo', |
|
1107 | + 'bar' |
|
1108 | + ); |
|
1109 | + |
|
1110 | + if (somethingElseIsTrue()) { |
|
1111 | + doOneThing(); |
|
1112 | + } else { |
|
1113 | + doTheOtherThing(); |
|
1114 | + } |
|
1115 | + ?> |
|
1116 | 1116 | </div> |
1117 | 1117 | <?php |
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | $foo = [ |
1121 | - new class() implements Bar { |
|
1121 | + new class() implements Bar { |
|
1122 | 1122 | |
1123 | - public static function foo(): string |
|
1124 | - { |
|
1125 | - return 'foo'; |
|
1126 | - } |
|
1127 | - }, |
|
1123 | + public static function foo(): string |
|
1124 | + { |
|
1125 | + return 'foo'; |
|
1126 | + } |
|
1127 | + }, |
|
1128 | 1128 | ]; |
1129 | 1129 | |
1130 | 1130 | $foo = [ |
1131 | - function () { |
|
1132 | - if ($foo) { |
|
1133 | - return 'foo'; |
|
1134 | - } |
|
1135 | - }, |
|
1131 | + function () { |
|
1132 | + if ($foo) { |
|
1133 | + return 'foo'; |
|
1134 | + } |
|
1135 | + }, |
|
1136 | 1136 | ]; |
1137 | 1137 | |
1138 | 1138 | $foo |
1139 | - ->bar(foo(function () { |
|
1140 | - }), foo(function () { |
|
1141 | - })); |
|
1139 | + ->bar(foo(function () { |
|
1140 | + }), foo(function () { |
|
1141 | + })); |
|
1142 | 1142 | |
1143 | 1143 | echo 'foo'; |
1144 | 1144 | |
1145 | 1145 | class Test { |
1146 | 1146 | |
1147 | - public function a() { |
|
1148 | - ?>a<?php |
|
1149 | - } |
|
1147 | + public function a() { |
|
1148 | + ?>a<?php |
|
1149 | + } |
|
1150 | 1150 | |
1151 | - public function b( |
|
1152 | - $a |
|
1153 | - ) { |
|
1154 | - echo $a; |
|
1155 | - } |
|
1151 | + public function b( |
|
1152 | + $a |
|
1153 | + ) { |
|
1154 | + echo $a; |
|
1155 | + } |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | $foo = foo( |
1159 | - function () { |
|
1160 | - $foo->debug( |
|
1161 | - $a, |
|
1162 | - $b |
|
1163 | - ); |
|
1164 | - |
|
1165 | - if ($a) { |
|
1166 | - $b = $a; |
|
1167 | - } |
|
1168 | - } |
|
1159 | + function () { |
|
1160 | + $foo->debug( |
|
1161 | + $a, |
|
1162 | + $b |
|
1163 | + ); |
|
1164 | + |
|
1165 | + if ($a) { |
|
1166 | + $b = $a; |
|
1167 | + } |
|
1168 | + } |
|
1169 | 1169 | ); |
1170 | 1170 | |
1171 | 1171 | function test() |
1172 | 1172 | { |
1173 | - $array = []; |
|
1174 | - foreach ($array as $data) { |
|
1175 | - [ |
|
1176 | - 'key1' => $var1, |
|
1177 | - 'key2' => $var2, |
|
1178 | - ] = $data; |
|
1179 | - foreach ($var1 as $method) { |
|
1180 | - echo $method . $var2; |
|
1181 | - } |
|
1182 | - } |
|
1173 | + $array = []; |
|
1174 | + foreach ($array as $data) { |
|
1175 | + [ |
|
1176 | + 'key1' => $var1, |
|
1177 | + 'key2' => $var2, |
|
1178 | + ] = $data; |
|
1179 | + foreach ($var1 as $method) { |
|
1180 | + echo $method . $var2; |
|
1181 | + } |
|
1182 | + } |
|
1183 | 1183 | } |
1184 | 1184 | |
1185 | 1185 | switch ($a) { |
1186 | - case 0: |
|
1187 | - $a = function () { |
|
1188 | - }; |
|
1189 | - case 1: |
|
1190 | - break; |
|
1186 | + case 0: |
|
1187 | + $a = function () { |
|
1188 | + }; |
|
1189 | + case 1: |
|
1190 | + break; |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | 1193 | class Test |
1194 | 1194 | { |
1195 | - public function __construct() |
|
1196 | - { |
|
1195 | + public function __construct() |
|
1196 | + { |
|
1197 | 1197 | if (false) { |
1198 | 1198 | echo 0; |
1199 | - } |
|
1200 | - } |
|
1199 | + } |
|
1200 | + } |
|
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | return [ |
1204 | - 'veryLongKeySoIWantToMakeALineBreak' |
|
1205 | - => 'veryLonValueSoIWantToMakeALineBreak', |
|
1204 | + 'veryLongKeySoIWantToMakeALineBreak' |
|
1205 | + => 'veryLonValueSoIWantToMakeALineBreak', |
|
1206 | 1206 | |
1207 | - 'someOtherKey' => [ |
|
1208 | - 'someValue' |
|
1209 | - ], |
|
1207 | + 'someOtherKey' => [ |
|
1208 | + 'someValue' |
|
1209 | + ], |
|
1210 | 1210 | |
1211 | - 'arrayWithArraysInThere' => [ |
|
1212 | - ['Value1', 'Value1'] |
|
1213 | - ], |
|
1211 | + 'arrayWithArraysInThere' => [ |
|
1212 | + ['Value1', 'Value1'] |
|
1213 | + ], |
|
1214 | 1214 | ]; |
1215 | 1215 | |
1216 | 1216 | switch ($sContext) { |
1217 | - case 'SOMETHING': |
|
1218 | - case 'CONSTANT': |
|
1219 | - do_something(); |
|
1220 | - break; |
|
1221 | - case 'GLOBAL': |
|
1222 | - case 'GLOBAL1': |
|
1223 | - do_something(); |
|
1224 | - // Fall through |
|
1225 | - default: |
|
1226 | - { |
|
1227 | - do_something(); |
|
1228 | - } |
|
1217 | + case 'SOMETHING': |
|
1218 | + case 'CONSTANT': |
|
1219 | + do_something(); |
|
1220 | + break; |
|
1221 | + case 'GLOBAL': |
|
1222 | + case 'GLOBAL1': |
|
1223 | + do_something(); |
|
1224 | + // Fall through |
|
1225 | + default: |
|
1226 | + { |
|
1227 | + do_something(); |
|
1228 | + } |
|
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | array_map( |
1232 | - static function ( $item ) { |
|
1233 | - echo $item; |
|
1234 | - }, |
|
1235 | - $some_array |
|
1232 | + static function ( $item ) { |
|
1233 | + echo $item; |
|
1234 | + }, |
|
1235 | + $some_array |
|
1236 | 1236 | ); |
1237 | 1237 | |
1238 | 1238 | /** |
1239 | 1239 | * Comment. |
1240 | 1240 | */ |
1241 | 1241 | $a(function () use ($app) { |
1242 | - echo 'hi'; |
|
1242 | + echo 'hi'; |
|
1243 | 1243 | })(); |
1244 | 1244 | |
1245 | 1245 | $app->run(); |
1246 | 1246 | |
1247 | 1247 | function foo() |
1248 | 1248 | { |
1249 | - $foo('some |
|
1249 | + $foo('some |
|
1250 | 1250 | long description', function () { |
1251 | - }); |
|
1251 | + }); |
|
1252 | 1252 | |
1253 | - $foo('some |
|
1253 | + $foo('some |
|
1254 | 1254 | long |
1255 | 1255 | description', function () { |
1256 | - }); |
|
1256 | + }); |
|
1257 | 1257 | |
1258 | - $foo( |
|
1258 | + $foo( |
|
1259 | 1259 | 'some long description', function () { |
1260 | - }); |
|
1260 | + }); |
|
1261 | 1261 | } |
1262 | 1262 | |
1263 | 1263 | switch ( $a ) { |
1264 | 1264 | case 'a': |
1265 | - $b = 2; |
|
1266 | - /** |
|
1267 | - * A comment. |
|
1268 | - */ |
|
1269 | - apply_filter( 'something', $b ); |
|
1270 | - break; |
|
1265 | + $b = 2; |
|
1266 | + /** |
|
1267 | + * A comment. |
|
1268 | + */ |
|
1269 | + apply_filter( 'something', $b ); |
|
1270 | + break; |
|
1271 | 1271 | |
1272 | 1272 | case 'aa': |
1273 | - $b = 2; |
|
1274 | - /* |
|
1273 | + $b = 2; |
|
1274 | + /* |
|
1275 | 1275 | * A comment. |
1276 | 1276 | */ |
1277 | - apply_filter( 'something', $b ); |
|
1278 | - break; |
|
1277 | + apply_filter( 'something', $b ); |
|
1278 | + break; |
|
1279 | 1279 | |
1280 | 1280 | case 'b': |
1281 | - $b = 3; |
|
1281 | + $b = 3; |
|
1282 | 1282 | ?> |
1283 | 1283 | <input name="something" value="<?php echo $b; ?>"> |
1284 | 1284 | <?php |
1285 | - $b = 4; |
|
1286 | - break; |
|
1285 | + $b = 4; |
|
1286 | + break; |
|
1287 | 1287 | |
1288 | 1288 | default: |
1289 | - $b = 3; |
|
1290 | - ?> |
|
1289 | + $b = 3; |
|
1290 | + ?> |
|
1291 | 1291 | <input name="something" value="<?php echo $b; ?>"> |
1292 | 1292 | <?php |
1293 | - $b = 4; |
|
1294 | - break; |
|
1293 | + $b = 4; |
|
1294 | + break; |
|
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | // phpcs:set Generic.WhiteSpace.ScopeIndent exact true |
1298 | 1298 | $shortArray = [ |
1299 | - 'hello', |
|
1299 | + 'hello', |
|
1300 | 1300 | 'world', |
1301 | 1301 | ]; |
1302 | 1302 | |
1303 | 1303 | $shortArray = array( |
1304 | - 'hello', |
|
1304 | + 'hello', |
|
1305 | 1305 | 'world', |
1306 | 1306 | ); |
1307 | 1307 | |
1308 | 1308 | function foo() { |
1309 | - echo 'foo'; |
|
1310 | - echo 'bar'; |
|
1311 | - if ($foo) { |
|
1312 | - echo 'baz'; |
|
1313 | - } |
|
1309 | + echo 'foo'; |
|
1310 | + echo 'bar'; |
|
1311 | + if ($foo) { |
|
1312 | + echo 'baz'; |
|
1313 | + } |
|
1314 | 1314 | } |
1315 | 1315 | // phpcs:set Generic.WhiteSpace.ScopeIndent exact false |
1316 | 1316 | |
1317 | 1317 | function test() { |
1318 | - return [ |
|
1319 | - <<<'SQLDATA' |
|
1318 | + return [ |
|
1319 | + <<<'SQLDATA' |
|
1320 | 1320 | DATA |
1321 | 1321 | SQLDATA |
1322 | 1322 | , |
1323 | - ]; |
|
1323 | + ]; |
|
1324 | 1324 | } |
1325 | 1325 | |
1326 | 1326 | if ($foo) { |
1327 | 1327 | if ($oo) { |
1328 | - /* |
|
1328 | + /* |
|
1329 | 1329 | * |
1330 | 1330 | * |
1331 | 1331 | */ |
1332 | 1332 | } |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - function foo() |
|
1336 | - { |
|
1337 | - $foo = array( |
|
1338 | - ); |
|
1335 | + function foo() |
|
1336 | + { |
|
1337 | + $foo = array( |
|
1338 | + ); |
|
1339 | 1339 | |
1340 | - if ($foo) { |
|
1341 | - echo 'foo'; |
|
1342 | - } |
|
1340 | + if ($foo) { |
|
1341 | + echo 'foo'; |
|
1342 | + } |
|
1343 | 1343 | |
1344 | - return false; |
|
1345 | - } |
|
1344 | + return false; |
|
1345 | + } |
|
1346 | 1346 | |
1347 | 1347 | ?> |
1348 | 1348 | |
1349 | 1349 | <div> |
1350 | 1350 | <?php if ($foo) { |
1351 | - echo $foo; |
|
1352 | - } ?> |
|
1351 | + echo $foo; |
|
1352 | + } ?> |
|
1353 | 1353 | </div> |
1354 | 1354 | |
1355 | 1355 | <div> |
1356 | 1356 | <?php echo |
1357 | - foo( |
|
1358 | - $foo |
|
1359 | - ); |
|
1360 | - ?> |
|
1357 | + foo( |
|
1358 | + $foo |
|
1359 | + ); |
|
1360 | + ?> |
|
1361 | 1361 | </div> |
1362 | 1362 | |
1363 | 1363 | <?php |
1364 | 1364 | |
1365 | 1365 | if (true) { |
1366 | - ?> |
|
1366 | + ?> |
|
1367 | 1367 | <div> |
1368 | 1368 | <?php |
1369 | 1369 | |
1370 | - if (true) { |
|
1371 | - ?> |
|
1370 | + if (true) { |
|
1371 | + ?> |
|
1372 | 1372 | <?php |
1373 | - } |
|
1373 | + } |
|
1374 | 1374 | |
1375 | - if (true |
|
1376 | - || false) { |
|
1377 | - ?> |
|
1375 | + if (true |
|
1376 | + || false) { |
|
1377 | + ?> |
|
1378 | 1378 | <?php |
1379 | - } |
|
1379 | + } |
|
1380 | 1380 | |
1381 | - ?> |
|
1381 | + ?> |
|
1382 | 1382 | </div> |
1383 | 1383 | <?php |
1384 | 1384 | } |
1385 | 1385 | |
1386 | 1386 | foo(function () { |
1387 | - if ($conditionA && |
|
1388 | - $conditionB |
|
1389 | - ) { |
|
1390 | - if ($conditionC) { |
|
1391 | - $a = 1; |
|
1392 | - } |
|
1393 | - } |
|
1387 | + if ($conditionA && |
|
1388 | + $conditionB |
|
1389 | + ) { |
|
1390 | + if ($conditionC) { |
|
1391 | + $a = 1; |
|
1392 | + } |
|
1393 | + } |
|
1394 | 1394 | }); |
1395 | 1395 | |
1396 | 1396 | switch($foo) |
1397 | 1397 | { |
1398 | - case 1: |
|
1399 | - $value = 1; break; |
|
1400 | - case 2: |
|
1401 | - if ($bar) { |
|
1402 | - break; |
|
1403 | - } |
|
1404 | - default: |
|
1405 | - $value = 0; |
|
1398 | + case 1: |
|
1399 | + $value = 1; break; |
|
1400 | + case 2: |
|
1401 | + if ($bar) { |
|
1402 | + break; |
|
1403 | + } |
|
1404 | + default: |
|
1405 | + $value = 0; |
|
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | ?> |
1409 | 1409 | |
1410 | 1410 | <?php |
1411 | - if (true) { |
|
1412 | - } |
|
1413 | - else if (true) { |
|
1414 | - } |
|
1411 | + if (true) { |
|
1412 | + } |
|
1413 | + else if (true) { |
|
1414 | + } |
|
1415 | 1415 | |
1416 | 1416 | $a = 1; |
1417 | 1417 |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | } |
255 | 255 | |
256 | 256 | switch ($foo) { |
257 | - case 1: |
|
258 | - switch ($bar) { |
|
257 | + case 1: |
|
258 | + switch ($bar) { |
|
259 | 259 | default: |
260 | 260 | echo $string{1}; |
261 | - } |
|
261 | + } |
|
262 | 262 | break; |
263 | 263 | } |
264 | 264 | |
@@ -274,25 +274,25 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | switch ($foo) { |
277 | - case 1: |
|
278 | - switch ($bar) { |
|
279 | - default: |
|
280 | - if ($something) { |
|
281 | - echo $string{1}; |
|
282 | - } else if ($else) { |
|
283 | - switch ($else) { |
|
284 | - default: |
|
285 | - } |
|
286 | - } |
|
277 | + case 1: |
|
278 | + switch ($bar) { |
|
279 | + default: |
|
280 | + if ($something) { |
|
281 | + echo $string{1}; |
|
282 | + } else if ($else) { |
|
283 | + switch ($else) { |
|
284 | + default: |
|
285 | + } |
|
286 | + } |
|
287 | 287 | } |
288 | 288 | break; |
289 | 289 | } |
290 | 290 | |
291 | 291 | switch ($name) { |
292 | - case "1": |
|
293 | - case "2": |
|
294 | - case "3": |
|
295 | - return true; |
|
292 | + case "1": |
|
293 | + case "2": |
|
294 | + case "3": |
|
295 | + return true; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | switch ($name) { |
@@ -314,16 +314,16 @@ discard block |
||
314 | 314 | } |
315 | 315 | |
316 | 316 | switch ($name) { |
317 | - case "1": |
|
318 | - switch ($name2) { |
|
317 | + case "1": |
|
318 | + switch ($name2) { |
|
319 | 319 | case "1": |
320 | 320 | break; |
321 | 321 | case "2": |
322 | 322 | break; |
323 | - } |
|
324 | - break; |
|
325 | - case "2": |
|
323 | + } |
|
326 | 324 | break; |
325 | + case "2": |
|
326 | + break; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | switch (true) { |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | switch (true) { |
342 | - case true: { |
|
343 | - echo 'hi'; |
|
344 | - } |
|
345 | - // No break here. |
|
346 | - case false: |
|
347 | - case true: |
|
348 | - case null:{ |
|
349 | - echo 'hi'; |
|
350 | - echo 'hi'; |
|
351 | - } |
|
352 | - break; |
|
342 | + case true: { |
|
343 | + echo 'hi'; |
|
344 | + } |
|
345 | + // No break here. |
|
346 | + case false: |
|
347 | + case true: |
|
348 | + case null:{ |
|
349 | + echo 'hi'; |
|
350 | + echo 'hi'; |
|
351 | + } |
|
352 | + break; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | switch (true) { |
@@ -910,29 +910,29 @@ discard block |
||
910 | 910 | } |
911 | 911 | |
912 | 912 | switch ($foo) { |
913 | - case 1: |
|
914 | - return array(); |
|
915 | - case 2: |
|
916 | - return ''; |
|
917 | - case 3: |
|
918 | - return $function(); |
|
919 | - case 4: |
|
920 | - return $functionCall($param[0]); |
|
921 | - case 5: |
|
922 | - return array() + array(); // Array Merge |
|
923 | - case 6: |
|
924 | - // String connect |
|
925 | - return $functionReturningString('') . $functionReturningString(array()); |
|
926 | - case 7: |
|
927 | - return functionCall( |
|
928 | - $withMultiLineParam[0], |
|
929 | - array(), |
|
930 | - $functionReturningString( |
|
931 | - $withMultiLineParam[1] |
|
932 | - ) |
|
933 | - ); |
|
934 | - case 8: |
|
935 | - return $param[0][0]; |
|
913 | + case 1: |
|
914 | + return array(); |
|
915 | + case 2: |
|
916 | + return ''; |
|
917 | + case 3: |
|
918 | + return $function(); |
|
919 | + case 4: |
|
920 | + return $functionCall($param[0]); |
|
921 | + case 5: |
|
922 | + return array() + array(); // Array Merge |
|
923 | + case 6: |
|
924 | + // String connect |
|
925 | + return $functionReturningString('') . $functionReturningString(array()); |
|
926 | + case 7: |
|
927 | + return functionCall( |
|
928 | + $withMultiLineParam[0], |
|
929 | + array(), |
|
930 | + $functionReturningString( |
|
931 | + $withMultiLineParam[1] |
|
932 | + ) |
|
933 | + ); |
|
934 | + case 8: |
|
935 | + return $param[0][0]; |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | class Test { |
@@ -948,10 +948,10 @@ discard block |
||
948 | 948 | } |
949 | 949 | |
950 | 950 | switch ($x) { |
951 | - case 1: |
|
952 | - return [1]; |
|
953 | - default: |
|
954 | - return [2]; |
|
951 | + case 1: |
|
952 | + return [1]; |
|
953 | + default: |
|
954 | + return [2]; |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | switch ($foo) { |
@@ -1024,16 +1024,16 @@ discard block |
||
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | switch ($parameter) { |
1027 | - case null: |
|
1028 | - return [ |
|
1029 | - 'foo' => in_array( |
|
1030 | - 'foo', |
|
1031 | - [] |
|
1032 | - ), |
|
1033 | - ]; |
|
1027 | + case null: |
|
1028 | + return [ |
|
1029 | + 'foo' => in_array( |
|
1030 | + 'foo', |
|
1031 | + [] |
|
1032 | + ), |
|
1033 | + ]; |
|
1034 | 1034 | |
1035 | - default: |
|
1036 | - return []; |
|
1035 | + default: |
|
1036 | + return []; |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | class SomeClass |
@@ -1183,11 +1183,11 @@ discard block |
||
1183 | 1183 | } |
1184 | 1184 | |
1185 | 1185 | switch ($a) { |
1186 | - case 0: |
|
1187 | - $a = function () { |
|
1188 | - }; |
|
1189 | - case 1: |
|
1190 | - break; |
|
1186 | + case 0: |
|
1187 | + $a = function () { |
|
1188 | + }; |
|
1189 | + case 1: |
|
1190 | + break; |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | 1193 | class Test |
@@ -1395,14 +1395,14 @@ discard block |
||
1395 | 1395 | |
1396 | 1396 | switch($foo) |
1397 | 1397 | { |
1398 | - case 1: |
|
1399 | - $value = 1; break; |
|
1400 | - case 2: |
|
1401 | - if ($bar) { |
|
1402 | - break; |
|
1403 | - } |
|
1404 | - default: |
|
1405 | - $value = 0; |
|
1398 | + case 1: |
|
1399 | + $value = 1; break; |
|
1400 | + case 2: |
|
1401 | + if ($bar) { |
|
1402 | + break; |
|
1403 | + } |
|
1404 | + default: |
|
1405 | + $value = 0; |
|
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | phpcs:set Generic.WhiteSpace.ScopeIndent tabIndent false |
2 | -<meta name="twitter:site" content="<?php echo $metaTagsData['twitter:site']; ?>"> |
|
2 | +<meta name="twitter:site" content="<?php echo $metaTagsData[ 'twitter:site' ]; ?>"> |
|
3 | 3 | <?php |
4 | 4 | class Test { |
5 | 5 | function __construct() |
@@ -14,24 +14,24 @@ discard block |
||
14 | 14 | |
15 | 15 | function hello2() |
16 | 16 | { |
17 | - if (TRUE) { |
|
17 | + if ( TRUE ) { |
|
18 | 18 | echo 'hello'; // no error here as its more than 4 spaces. |
19 | 19 | } else { |
20 | 20 | echo 'bye'; |
21 | 21 | } |
22 | 22 | |
23 | - while (TRUE) { |
|
23 | + while ( TRUE ) { |
|
24 | 24 | echo 'hello'; |
25 | 25 | } |
26 | 26 | |
27 | 27 | do { |
28 | 28 | echo 'hello'; |
29 | - } while (TRUE); |
|
29 | + } while ( TRUE ); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | function hello3() |
33 | 33 | { |
34 | - switch ($hello) { |
|
34 | + switch ( $hello ) { |
|
35 | 35 | case 'hello': |
36 | 36 | break; |
37 | 37 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | </head> |
45 | 45 | <body> |
46 | 46 | <?php |
47 | -if ($form->validate()) { |
|
47 | +if ( $form->validate() ) { |
|
48 | 48 | $safe = $form->getSubmitValues(); |
49 | 49 | } |
50 | 50 | ?> |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | public function open() |
62 | 62 | { |
63 | 63 | // Some inline stuff that shouldn't error |
64 | - if (TRUE) echo 'hello'; |
|
65 | - foreach ($tokens as $token) echo $token; |
|
64 | + if ( TRUE ) echo 'hello'; |
|
65 | + foreach ( $tokens as $token ) echo $token; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -74,17 +74,17 @@ discard block |
||
74 | 74 | public function close() |
75 | 75 | { |
76 | 76 | // All ok. |
77 | - if (TRUE) { |
|
78 | - if (TRUE) { |
|
79 | - } else if (FALSE) { |
|
80 | - foreach ($tokens as $token) { |
|
81 | - switch ($token) { |
|
77 | + if ( TRUE ) { |
|
78 | + if ( TRUE ) { |
|
79 | + } else if ( FALSE ) { |
|
80 | + foreach ( $tokens as $token ) { |
|
81 | + switch ( $token ) { |
|
82 | 82 | case '1': |
83 | 83 | case '2': |
84 | - if (true) { |
|
85 | - if (false) { |
|
86 | - if (false) { |
|
87 | - if (false) { |
|
84 | + if ( true ) { |
|
85 | + if ( false ) { |
|
86 | + if ( false ) { |
|
87 | + if ( false ) { |
|
88 | 88 | echo 'hello'; |
89 | 89 | } |
90 | 90 | } |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | break; |
96 | 96 | } |
97 | 97 | do { |
98 | - while (true) { |
|
99 | - foreach ($tokens as $token) { |
|
100 | - for ($i = 0; $i < $token; $i++) { |
|
98 | + while ( true ) { |
|
99 | + foreach ( $tokens as $token ) { |
|
100 | + for ( $i = 0; $i < $token; $i++ ) { |
|
101 | 101 | echo 'hello'; |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | - } while (true); |
|
105 | + } while ( true ); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
@@ -152,28 +152,28 @@ discard block |
||
152 | 152 | public function parse() |
153 | 153 | { |
154 | 154 | |
155 | - foreach ($t as $ndx => $token) { |
|
156 | - if (is_array($token)) { |
|
155 | + foreach ( $t as $ndx => $token ) { |
|
156 | + if ( is_array( $token ) ) { |
|
157 | 157 | echo 'here'; |
158 | 158 | } else { |
159 | - $ts[] = array("token" => $token, "value" => ''); |
|
159 | + $ts[ ] = array( "token" => $token, "value" => '' ); |
|
160 | 160 | |
161 | - $last = count($ts) - 1; |
|
161 | + $last = count( $ts ) - 1; |
|
162 | 162 | |
163 | - switch ($token) { |
|
163 | + switch ( $token ) { |
|
164 | 164 | case '(': |
165 | 165 | |
166 | - if ($last >= 3 && |
|
167 | - $ts[0]['token'] != T_CLASS && |
|
168 | - $ts[$last - 2]['token'] == T_OBJECT_OPERATOR && |
|
169 | - $ts[$last - 3]['token'] == T_VARIABLE ) { |
|
166 | + if ( $last >= 3 && |
|
167 | + $ts[ 0 ][ 'token' ] != T_CLASS && |
|
168 | + $ts[ $last - 2 ][ 'token' ] == T_OBJECT_OPERATOR && |
|
169 | + $ts[ $last - 3 ][ 'token' ] == T_VARIABLE ) { |
|
170 | 170 | |
171 | 171 | |
172 | - if (true) { |
|
172 | + if ( true ) { |
|
173 | 173 | echo 'hello'; |
174 | 174 | } |
175 | 175 | } |
176 | - array_push($braces, $token); |
|
176 | + array_push( $braces, $token ); |
|
177 | 177 | break; |
178 | 178 | } |
179 | 179 | } |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | return $o; |
196 | 196 | } |
197 | 197 | |
198 | -if ($a === true || $a === true || $a === true || $a === true || |
|
199 | - $a === true || $a === true || $a === true || $a === true) { |
|
198 | +if ( $a === true || $a === true || $a === true || $a === true || |
|
199 | + $a === true || $a === true || $a === true || $a === true ) { |
|
200 | 200 | |
201 | 201 | echo 'hello'; |
202 | 202 | } |
203 | 203 | |
204 | -if ($true) { |
|
204 | +if ( $true ) { |
|
205 | 205 | /* First comment line |
206 | 206 | * |
207 | 207 | * Comment test here |
@@ -225,47 +225,47 @@ discard block |
||
225 | 225 | # $m[] = 'declare'; |
226 | 226 | } |
227 | 227 | |
228 | -foreach ($elements as $element) { |
|
229 | - if ($something) { |
|
228 | +foreach ( $elements as $element ) { |
|
229 | + if ( $something ) { |
|
230 | 230 | // Do IF. |
231 | - } else if ($somethingElse) { |
|
231 | + } else if ( $somethingElse ) { |
|
232 | 232 | // Do ELSE. |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | -if ($condition) { |
|
236 | +if ( $condition ) { |
|
237 | 237 | echo "This is a long |
238 | 238 | string that spans $numLines lines |
239 | 239 | without indenting. |
240 | 240 | "; |
241 | 241 | } |
242 | 242 | |
243 | -if ($condition) { |
|
243 | +if ( $condition ) { |
|
244 | 244 | echo 'This is a long |
245 | 245 | string that spans multiple lines |
246 | 246 | with indenting. |
247 | 247 | '; |
248 | 248 | } |
249 | 249 | |
250 | -if ($condition) { |
|
250 | +if ( $condition ) { |
|
251 | 251 | echo 'This is a long |
252 | 252 | string that spans multiple lines |
253 | 253 | with indenting.'; |
254 | 254 | } |
255 | 255 | |
256 | -switch ($foo) { |
|
256 | +switch ( $foo ) { |
|
257 | 257 | case 1: |
258 | - switch ($bar) { |
|
258 | + switch ( $bar ) { |
|
259 | 259 | default: |
260 | 260 | echo $string{1}; |
261 | 261 | } |
262 | 262 | break; |
263 | 263 | } |
264 | 264 | |
265 | -function temp($foo, $bar) { |
|
266 | - switch ($foo) { |
|
265 | +function temp( $foo, $bar ) { |
|
266 | + switch ( $foo ) { |
|
267 | 267 | case 1: |
268 | - switch ($bar) { |
|
268 | + switch ( $bar ) { |
|
269 | 269 | default: |
270 | 270 | return $foo; |
271 | 271 | } |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
276 | -switch ($foo) { |
|
276 | +switch ( $foo ) { |
|
277 | 277 | case 1: |
278 | - switch ($bar) { |
|
278 | + switch ( $bar ) { |
|
279 | 279 | default: |
280 | - if ($something) { |
|
280 | + if ( $something ) { |
|
281 | 281 | echo $string{1}; |
282 | - } else if ($else) { |
|
283 | - switch ($else) { |
|
282 | + } else if ( $else ) { |
|
283 | + switch ( $else ) { |
|
284 | 284 | default: |
285 | 285 | } |
286 | 286 | } |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | break; |
289 | 289 | } |
290 | 290 | |
291 | -switch ($name) { |
|
291 | +switch ( $name ) { |
|
292 | 292 | case "1": |
293 | 293 | case "2": |
294 | 294 | case "3": |
295 | 295 | return true; |
296 | 296 | } |
297 | 297 | |
298 | -switch ($name) { |
|
298 | +switch ( $name ) { |
|
299 | 299 | case "1": |
300 | 300 | case "2": |
301 | 301 | case "3": |
@@ -313,9 +313,9 @@ discard block |
||
313 | 313 | |
314 | 314 | } |
315 | 315 | |
316 | -switch ($name) { |
|
316 | +switch ( $name ) { |
|
317 | 317 | case "1": |
318 | - switch ($name2) { |
|
318 | + switch ( $name2 ) { |
|
319 | 319 | case "1": |
320 | 320 | break; |
321 | 321 | case "2": |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | break; |
327 | 327 | } |
328 | 328 | |
329 | -switch (true) { |
|
329 | +switch ( true ) { |
|
330 | 330 | case true: { |
331 | 331 | } |
332 | 332 | echo 'hi'; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | break; |
339 | 339 | } |
340 | 340 | |
341 | -switch (true) { |
|
341 | +switch ( true ) { |
|
342 | 342 | case true: { |
343 | 343 | echo 'hi'; |
344 | 344 | } |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | break; |
353 | 353 | } |
354 | 354 | |
355 | -switch (true) { |
|
355 | +switch ( true ) { |
|
356 | 356 | case true: { |
357 | - if (true) { |
|
357 | + if ( true ) { |
|
358 | 358 | echo 'hi'; |
359 | 359 | } |
360 | 360 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | function c() |
367 | 367 | { |
368 | 368 | $this->doSomething( |
369 | - function () { |
|
369 | + function() { |
|
370 | 370 | echo 123; |
371 | 371 | } |
372 | 372 | ); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | some_function( |
377 | 377 | function() { |
378 | 378 | $a = 403; |
379 | - if ($a === 404) { |
|
379 | + if ( $a === 404 ) { |
|
380 | 380 | $a = 403; |
381 | 381 | } |
382 | 382 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | some_function( |
386 | 386 | function() { |
387 | 387 | $a = 403; |
388 | - if ($a === 404) { |
|
388 | + if ( $a === 404 ) { |
|
389 | 389 | $a = 403; |
390 | 390 | } |
391 | 391 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | |
394 | 394 | $myFunction = function() { |
395 | 395 | $a = 403; |
396 | - if ($a === 404) { |
|
396 | + if ( $a === 404 ) { |
|
397 | 397 | $a = 403; |
398 | 398 | } |
399 | 399 | }; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | { |
416 | 416 | public static function myFunction() |
417 | 417 | { |
418 | - if (empty($keywords) === FALSE) { |
|
418 | + if ( empty( $keywords ) === FALSE ) { |
|
419 | 419 | $keywords = 'foo'; |
420 | 420 | $existing = 'foo'; |
421 | 421 | } |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | }//end class |
428 | 428 | |
429 | 429 | $var = call_user_func( |
430 | - $new_var = function () use (&$a) { |
|
431 | - if ($a > 0) { |
|
430 | + $new_var = function() use ( &$a ) { |
|
431 | + if ( $a > 0 ) { |
|
432 | 432 | return $a++; |
433 | 433 | } else { |
434 | 434 | return $a--; |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | { |
443 | 443 | return array( |
444 | 444 | 'functions' => Array( |
445 | - 'function1' => function ($a, $b, $c) { |
|
445 | + 'function1' => function( $a, $b, $c ) { |
|
446 | 446 | $a = $b + $c; |
447 | 447 | $b = $c / 2; |
448 | - return Array($a, $b, $c); |
|
448 | + return Array( $a, $b, $c ); |
|
449 | 449 | }, |
450 | 450 | ), |
451 | 451 | ); |
@@ -455,29 +455,29 @@ discard block |
||
455 | 455 | |
456 | 456 | <div> |
457 | 457 | <?php |
458 | - if ($myvar == 'test') { |
|
458 | + if ( $myvar == 'test' ) { |
|
459 | 459 | echo 'something'; |
460 | 460 | } |
461 | 461 | ?> |
462 | 462 | <div> |
463 | 463 | <div> |
464 | 464 | <?php |
465 | - if ($myvar == 'test') { |
|
465 | + if ( $myvar == 'test' ) { |
|
466 | 466 | echo 'something'; |
467 | 467 | } |
468 | 468 | ?> |
469 | 469 | <div> |
470 | 470 | <div> |
471 | 471 | <?php |
472 | -if ($myvar == 'test') { |
|
472 | +if ( $myvar == 'test' ) { |
|
473 | 473 | echo 'something'; |
474 | 474 | } |
475 | 475 | ?> |
476 | 476 | <div> |
477 | 477 | <body> |
478 | 478 | <?php |
479 | - if (isset($_GET["test"])) { |
|
480 | - if ($_GET["test"] <> "") { |
|
479 | + if ( isset( $_GET[ "test" ] ) ) { |
|
480 | + if ( $_GET[ "test" ] <> "" ) { |
|
481 | 481 | $test = true; |
482 | 482 | } else { |
483 | 483 | $test = true; |
@@ -487,13 +487,13 @@ discard block |
||
487 | 487 | </body> |
488 | 488 | |
489 | 489 | <?php |
490 | -if (true) { |
|
490 | +if ( true ) { |
|
491 | 491 | ?> |
492 | 492 | <div> |
493 | 493 | <div> |
494 | 494 | <div> |
495 | 495 | <?php |
496 | - if (true) { |
|
496 | + if ( true ) { |
|
497 | 497 | echo 'hello'; |
498 | 498 | } else { |
499 | 499 | echo 'goodbye'; |
@@ -507,47 +507,47 @@ discard block |
||
507 | 507 | echo 'else'; |
508 | 508 | } |
509 | 509 | ?> |
510 | -<?php if (isset($param)) { ?> |
|
510 | +<?php if ( isset( $param ) ) { ?> |
|
511 | 511 | <h3>some text</h3> |
512 | 512 | <?php } |
513 | 513 | |
514 | 514 | $list = [ |
515 | - 'fn' => function ($a) { |
|
516 | - if ($a === true) { |
|
515 | + 'fn' => function( $a ) { |
|
516 | + if ( $a === true ) { |
|
517 | 517 | echo 'hi'; |
518 | 518 | } |
519 | 519 | } |
520 | 520 | ]; |
521 | 521 | |
522 | 522 | $list = [ |
523 | - 'fn' => function ($a) { |
|
524 | - if ($a === true) { |
|
523 | + 'fn' => function( $a ) { |
|
524 | + if ( $a === true ) { |
|
525 | 525 | echo 'hi'; |
526 | 526 | } |
527 | 527 | } |
528 | 528 | ]; |
529 | 529 | |
530 | -if ($foo) { |
|
531 | - foreach ($bar as $baz) { |
|
532 | - if ($baz) { |
|
530 | +if ( $foo ) { |
|
531 | + foreach ( $bar as $baz ) { |
|
532 | + if ( $baz ) { |
|
533 | 533 | ?> |
534 | 534 | <div> |
535 | 535 | <div> |
536 | 536 | <div> |
537 | 537 | <?php |
538 | - if ($baz > 1) { |
|
538 | + if ( $baz > 1 ) { |
|
539 | 539 | echo '1'; |
540 | 540 | } |
541 | 541 | ?> |
542 | 542 | </div> |
543 | 543 | <?php |
544 | - if ($baz > 1) { |
|
544 | + if ( $baz > 1 ) { |
|
545 | 545 | echo '1'; |
546 | 546 | } |
547 | 547 | ?> |
548 | 548 | </div> |
549 | 549 | <?php |
550 | - if ($baz > 1) { |
|
550 | + if ( $baz > 1 ) { |
|
551 | 551 | echo '1'; |
552 | 552 | } |
553 | 553 | ?> |
@@ -558,10 +558,10 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | ?> |
561 | -<title><?= CHtml::encode($this->pageTitle); ?></title> |
|
561 | +<title><?= CHtml::encode( $this->pageTitle ); ?></title> |
|
562 | 562 | |
563 | 563 | <?php |
564 | -if ($foo) { |
|
564 | +if ( $foo ) { |
|
565 | 565 | echo '1'; |
566 | 566 | echo '2'; |
567 | 567 | echo '3'; |
@@ -569,18 +569,18 @@ discard block |
||
569 | 569 | |
570 | 570 | $array = array(); |
571 | 571 | array_map( |
572 | - function($x) |
|
572 | + function( $x ) |
|
573 | 573 | { |
574 | - return trim($x); |
|
574 | + return trim( $x ); |
|
575 | 575 | }, |
576 | 576 | $array |
577 | 577 | ); |
578 | 578 | |
579 | -function foo(){return function(){};} |
|
579 | +function foo() {return function() {};} |
|
580 | 580 | |
581 | -$mockedDatabase->expects($this->at(2)) |
|
582 | - ->with($this->callback( |
|
583 | - function ($subject) |
|
581 | +$mockedDatabase->expects( $this->at( 2 ) ) |
|
582 | + ->with( $this->callback( |
|
583 | + function( $subject ) |
|
584 | 584 | { |
585 | 585 | } |
586 | 586 | ) |
@@ -589,39 +589,39 @@ discard block |
||
589 | 589 | /** @var Database $mockedDatabase */ |
590 | 590 | /** @var Container $mockedContainer */ |
591 | 591 | |
592 | -echo $string->append('foo') |
|
593 | - ->appaend('bar') |
|
594 | - ->appaend('baz') |
|
592 | +echo $string->append( 'foo' ) |
|
593 | + ->appaend( 'bar' ) |
|
594 | + ->appaend( 'baz' ) |
|
595 | 595 | ->outputUsing( |
596 | - function () |
|
596 | + function() |
|
597 | 597 | { |
598 | 598 | } |
599 | 599 | ); |
600 | 600 | |
601 | 601 | echo PHP_EOL; |
602 | 602 | |
603 | -switch ($arg) { |
|
603 | +switch ( $arg ) { |
|
604 | 604 | case 1: |
605 | 605 | break; |
606 | 606 | case 2: |
607 | - if ($arg2 == 'foo') { |
|
607 | + if ( $arg2 == 'foo' ) { |
|
608 | 608 | } |
609 | 609 | case 3: |
610 | 610 | default: |
611 | 611 | echo 'default'; |
612 | 612 | } |
613 | 613 | |
614 | -if ($tokens[$stackPtr]['content']{0} === '#') { |
|
615 | -} else if ($tokens[$stackPtr]['content']{0} === '/' |
|
616 | - && $tokens[$stackPtr]['content']{1} === '/' |
|
614 | +if ( $tokens[ $stackPtr ][ 'content' ]{0} === '#' ) { |
|
615 | +} else if ( $tokens[ $stackPtr ][ 'content' ]{0} === '/' |
|
616 | + && $tokens[ $stackPtr ][ 'content' ]{1} === '/' |
|
617 | 617 | ) { |
618 | 618 | } |
619 | 619 | |
620 | 620 | $var = call_user_func( |
621 | 621 | function() { |
622 | - if ($foo) { |
|
622 | + if ( $foo ) { |
|
623 | 623 | $new_var = function() { |
624 | - if ($a > 0) { |
|
624 | + if ( $a > 0 ) { |
|
625 | 625 | return $a++; |
626 | 626 | } else { |
627 | 627 | return $a--; |
@@ -643,20 +643,20 @@ discard block |
||
643 | 643 | $var = [ |
644 | 644 | [ |
645 | 645 | '1' => |
646 | - function () { |
|
646 | + function() { |
|
647 | 647 | return true; |
648 | 648 | }, |
649 | 649 | ], |
650 | 650 | [ |
651 | 651 | '1' => |
652 | - function () { |
|
652 | + function() { |
|
653 | 653 | return true; |
654 | 654 | }, |
655 | 655 | '2' => true, |
656 | 656 | ] |
657 | 657 | ]; |
658 | 658 | |
659 | -if ($foo) { |
|
659 | +if ( $foo ) { |
|
660 | 660 | ?> |
661 | 661 | </p> |
662 | 662 | <?php |
@@ -664,11 +664,11 @@ discard block |
||
664 | 664 | |
665 | 665 | function foo() |
666 | 666 | { |
667 | - $failingTests[$testName][] = array( |
|
668 | - 'comment' => self::_replaceKeywords($failingComment, $result), |
|
667 | + $failingTests[ $testName ][ ] = array( |
|
668 | + 'comment' => self::_replaceKeywords( $failingComment, $result ), |
|
669 | 669 | 'screenshot' => Test::getScreenshotPath( |
670 | 670 | $projectid, |
671 | - $result['class_name'], |
|
671 | + $result[ 'class_name' ], |
|
672 | 672 | ), |
673 | 673 | ); |
674 | 674 | |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $this->mockedDatabase |
678 | 678 | ->with( |
679 | 679 | $this->callback( |
680 | - function () { |
|
680 | + function() { |
|
681 | 681 | return; |
682 | 682 | } |
683 | 683 | ) |
@@ -687,20 +687,20 @@ discard block |
||
687 | 687 | |
688 | 688 | function a() |
689 | 689 | { |
690 | - if (true) { |
|
691 | - static::$a[$b] = |
|
692 | - static::where($c) |
|
693 | - ->where($c) |
|
690 | + if ( true ) { |
|
691 | + static::$a[ $b ] = |
|
692 | + static::where( $c ) |
|
693 | + ->where( $c ) |
|
694 | 694 | ->where( |
695 | - function ($d) { |
|
695 | + function( $d ) { |
|
696 | 696 | $d->whereNull(); |
697 | 697 | $d->orWhere(); |
698 | 698 | } |
699 | 699 | ) |
700 | 700 | ->first(); |
701 | 701 | |
702 | - if (static::$a[$b] === null) { |
|
703 | - static::$a[$b] = new static( |
|
702 | + if ( static::$a[ $b ] === null ) { |
|
703 | + static::$a[ $b ] = new static( |
|
704 | 704 | array( |
705 | 705 | 'a' => $a->id, |
706 | 706 | 'a' => $a->id, |
@@ -709,12 +709,12 @@ discard block |
||
709 | 709 | } |
710 | 710 | } |
711 | 711 | |
712 | - return static::$a[$b]; |
|
712 | + return static::$a[ $b ]; |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | $foo->load( |
716 | 716 | array( |
717 | - 'bar' => function ($baz) { |
|
717 | + 'bar' => function( $baz ) { |
|
718 | 718 | $baz->call(); |
719 | 719 | } |
720 | 720 | ) |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | |
725 | 725 | $foo = array_unique( |
726 | 726 | array_map( |
727 | - function ($entry) { |
|
727 | + function( $entry ) { |
|
728 | 728 | return $entry * 2; |
729 | 729 | }, |
730 | 730 | array() |
731 | 731 | ) |
732 | 732 | ); |
733 | -bar($foo); |
|
733 | +bar( $foo ); |
|
734 | 734 | |
735 | 735 | class PHP_CodeSniffer_Tokenizers_JS |
736 | 736 | { |
@@ -747,11 +747,11 @@ discard block |
||
747 | 747 | } |
748 | 748 | |
749 | 749 | echo $string-> |
750 | - append('foo')-> |
|
751 | - appaend('bar')-> |
|
752 | - appaend('baz')-> |
|
750 | + append( 'foo' )-> |
|
751 | + appaend( 'bar' )-> |
|
752 | + appaend( 'baz' )-> |
|
753 | 753 | outputUsing( |
754 | - function () |
|
754 | + function() |
|
755 | 755 | { |
756 | 756 | } |
757 | 757 | ); |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | $str = 'the items I want to show are: ' . |
760 | 760 | implode( |
761 | 761 | ', ', |
762 | - array('a', 'b', 'c') |
|
762 | + array( 'a', 'b', 'c' ) |
|
763 | 763 | ); |
764 | 764 | |
765 | 765 | echo $str; |
@@ -770,16 +770,16 @@ discard block |
||
770 | 770 | |
771 | 771 | echo $str; |
772 | 772 | |
773 | -bar([ |
|
774 | - 'foo' => foo(function () { |
|
773 | +bar( [ |
|
774 | + 'foo' => foo( function() { |
|
775 | 775 | return 'foo'; |
776 | 776 | }) |
777 | -]); |
|
777 | +] ); |
|
778 | 778 | |
779 | 779 | $domains = array_unique( |
780 | 780 | array_map( |
781 | - function ($url) { |
|
782 | - $urlObject = new \Purl\Url($url); |
|
781 | + function( $url ) { |
|
782 | + $urlObject = new \Purl\Url( $url ); |
|
783 | 783 | return $urlObject->registerableDomain; |
784 | 784 | }, |
785 | 785 | $sites |
@@ -788,27 +788,27 @@ discard block |
||
788 | 788 | |
789 | 789 | return $domains; |
790 | 790 | |
791 | -if ($a == 5) : |
|
791 | +if ( $a == 5 ) : |
|
792 | 792 | echo "a equals 5"; |
793 | 793 | echo "..."; |
794 | -elseif ($a == 6) : |
|
794 | +elseif ( $a == 6 ) : |
|
795 | 795 | echo "a equals 6"; |
796 | 796 | echo "!!!"; |
797 | 797 | else : |
798 | 798 | echo "a is neither 5 nor 6"; |
799 | 799 | endif; |
800 | 800 | |
801 | -if ($foo): |
|
802 | -if ($bar) $foo = 1; |
|
803 | -elseif ($baz) $foo = 2; |
|
801 | +if ( $foo ): |
|
802 | +if ( $bar ) $foo = 1; |
|
803 | +elseif ( $baz ) $foo = 2; |
|
804 | 804 | endif; |
805 | 805 | |
806 | 806 | $this |
807 | - ->method(array( |
|
807 | + ->method( array( |
|
808 | 808 | 'foo' => 'bar', |
809 | 809 | ), 'arg', array( |
810 | 810 | 'foo' => 'bar', |
811 | - )); |
|
811 | + ) ); |
|
812 | 812 | |
813 | 813 | class Foo |
814 | 814 | { |
@@ -827,10 +827,10 @@ discard block |
||
827 | 827 | foo(); |
828 | 828 | |
829 | 829 | array( |
830 | - 'key1' => function ($bar) { |
|
830 | + 'key1' => function( $bar ) { |
|
831 | 831 | return $bar; |
832 | 832 | }, |
833 | - 'key2' => function ($foo) { |
|
833 | + 'key2' => function( $foo ) { |
|
834 | 834 | return $foo; |
835 | 835 | }, |
836 | 836 | ); |
@@ -845,10 +845,10 @@ discard block |
||
845 | 845 | |
846 | 846 | try { |
847 | 847 | echo 'foo'; |
848 | -} catch (\Exception $e) { |
|
848 | +} catch ( \Exception $e ) { |
|
849 | 849 | echo 'catch'; |
850 | 850 | } finally { |
851 | - if (false) { |
|
851 | + if ( false ) { |
|
852 | 852 | echo 'finally false'; |
853 | 853 | } |
854 | 854 | } |
@@ -895,21 +895,21 @@ discard block |
||
895 | 895 | { |
896 | 896 | public function get() |
897 | 897 | { |
898 | - $foo = ['b' => 'c', |
|
898 | + $foo = [ 'b' => 'c', |
|
899 | 899 | 'd' => [ |
900 | - ['e' => 'f'] |
|
901 | - ]]; |
|
900 | + [ 'e' => 'f' ] |
|
901 | + ] ]; |
|
902 | 902 | echo '42'; |
903 | 903 | |
904 | - $foo = array('b' => 'c', |
|
904 | + $foo = array( 'b' => 'c', |
|
905 | 905 | 'd' => array( |
906 | - array('e' => 'f') |
|
907 | - )); |
|
906 | + array( 'e' => 'f' ) |
|
907 | + ) ); |
|
908 | 908 | echo '42'; |
909 | 909 | } |
910 | 910 | } |
911 | 911 | |
912 | -switch ($foo) { |
|
912 | +switch ( $foo ) { |
|
913 | 913 | case 1: |
914 | 914 | return array(); |
915 | 915 | case 2: |
@@ -917,22 +917,22 @@ discard block |
||
917 | 917 | case 3: |
918 | 918 | return $function(); |
919 | 919 | case 4: |
920 | - return $functionCall($param[0]); |
|
920 | + return $functionCall( $param[ 0 ] ); |
|
921 | 921 | case 5: |
922 | 922 | return array() + array(); // Array Merge |
923 | 923 | case 6: |
924 | 924 | // String connect |
925 | - return $functionReturningString('') . $functionReturningString(array()); |
|
925 | + return $functionReturningString( '' ) . $functionReturningString( array() ); |
|
926 | 926 | case 7: |
927 | 927 | return functionCall( |
928 | - $withMultiLineParam[0], |
|
928 | + $withMultiLineParam[ 0 ], |
|
929 | 929 | array(), |
930 | 930 | $functionReturningString( |
931 | - $withMultiLineParam[1] |
|
931 | + $withMultiLineParam[ 1 ] |
|
932 | 932 | ) |
933 | 933 | ); |
934 | 934 | case 8: |
935 | - return $param[0][0]; |
|
935 | + return $param[ 0 ][ 0 ]; |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | class Test { |
@@ -947,40 +947,40 @@ discard block |
||
947 | 947 | } |
948 | 948 | } |
949 | 949 | |
950 | -switch ($x) { |
|
950 | +switch ( $x ) { |
|
951 | 951 | case 1: |
952 | - return [1]; |
|
952 | + return [ 1 ]; |
|
953 | 953 | default: |
954 | - return [2]; |
|
954 | + return [ 2 ]; |
|
955 | 955 | } |
956 | 956 | |
957 | -switch ($foo) { |
|
957 | +switch ( $foo ) { |
|
958 | 958 | case self::FOO: |
959 | - return $this->bar($gfoo, function ($id) { |
|
960 | - return FOO::bar($id); |
|
961 | - }, $values); |
|
959 | + return $this->bar( $gfoo, function( $id ) { |
|
960 | + return FOO::bar( $id ); |
|
961 | + }, $values ); |
|
962 | 962 | case self::BAR: |
963 | - $values = $this->bar($foo, $values); |
|
963 | + $values = $this->bar( $foo, $values ); |
|
964 | 964 | break; |
965 | 965 | } |
966 | 966 | |
967 | 967 | $var = array( |
968 | 968 | 'long description' => |
969 | - array(0, 'something'), |
|
969 | + array( 0, 'something' ), |
|
970 | 970 | 'another long description' => |
971 | - array(1, "something else") |
|
971 | + array( 1, "something else" ) |
|
972 | 972 | ); |
973 | 973 | |
974 | 974 | $services = array( |
975 | 975 | 'service 1' => |
976 | - Mockery::mock('class 1') |
|
977 | - ->shouldReceive('setFilter')->once() |
|
978 | - ->shouldReceive('getNbResults')->atLeast()->once() |
|
979 | - ->shouldReceive('getSlice')->once()->andReturn(array()) |
|
976 | + Mockery::mock( 'class 1' ) |
|
977 | + ->shouldReceive( 'setFilter' )->once() |
|
978 | + ->shouldReceive( 'getNbResults' )->atLeast()->once() |
|
979 | + ->shouldReceive( 'getSlice' )->once()->andReturn( array() ) |
|
980 | 980 | ->getMock(), |
981 | 981 | 'service 2' => |
982 | - Mockery::mock('class 2') |
|
983 | - ->shouldReceive('__invoke')->once() |
|
982 | + Mockery::mock( 'class 2' ) |
|
983 | + ->shouldReceive( '__invoke' )->once() |
|
984 | 984 | ->getMock() |
985 | 985 | ); |
986 | 986 | |
@@ -996,71 +996,71 @@ discard block |
||
996 | 996 | |
997 | 997 | try { |
998 | 998 | foo(); |
999 | -} catch (\Exception $e) { |
|
999 | +} catch ( \Exception $e ) { |
|
1000 | 1000 | $foo = function() { |
1001 | 1001 | return 'foo'; |
1002 | 1002 | }; |
1003 | 1003 | |
1004 | - if (true) { |
|
1004 | + if ( true ) { |
|
1005 | 1005 | } |
1006 | 1006 | } |
1007 | 1007 | |
1008 | -if ($foo) { |
|
1008 | +if ( $foo ) { |
|
1009 | 1009 | foo(); |
1010 | -} else if ($e) { |
|
1010 | +} else if ( $e ) { |
|
1011 | 1011 | $foo = function() { |
1012 | 1012 | return 'foo'; |
1013 | 1013 | }; |
1014 | 1014 | |
1015 | - if (true) { |
|
1015 | + if ( true ) { |
|
1016 | 1016 | } |
1017 | 1017 | } else { |
1018 | 1018 | $foo = function() { |
1019 | 1019 | return 'foo'; |
1020 | 1020 | }; |
1021 | 1021 | |
1022 | - if (true) { |
|
1022 | + if ( true ) { |
|
1023 | 1023 | } |
1024 | 1024 | } |
1025 | 1025 | |
1026 | -switch ($parameter) { |
|
1026 | +switch ( $parameter ) { |
|
1027 | 1027 | case null: |
1028 | 1028 | return [ |
1029 | 1029 | 'foo' => in_array( |
1030 | 1030 | 'foo', |
1031 | - [] |
|
1031 | + [ ] |
|
1032 | 1032 | ), |
1033 | 1033 | ]; |
1034 | 1034 | |
1035 | 1035 | default: |
1036 | - return []; |
|
1036 | + return [ ]; |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | class SomeClass |
1040 | 1040 | { |
1041 | 1041 | public function someFunc() |
1042 | 1042 | { |
1043 | - a(function () { |
|
1043 | + a( function() { |
|
1044 | 1044 | echo "a"; |
1045 | - })->b(function () { |
|
1045 | + })->b( function() { |
|
1046 | 1046 | echo "b"; |
1047 | 1047 | }); |
1048 | 1048 | |
1049 | - if (true) { |
|
1049 | + if ( true ) { |
|
1050 | 1050 | echo "c"; |
1051 | 1051 | } |
1052 | 1052 | echo "d"; |
1053 | 1053 | } |
1054 | 1054 | } |
1055 | 1055 | |
1056 | -$params = self::validate_parameters(self::read_competency_framework_parameters(), |
|
1056 | +$params = self::validate_parameters( self::read_competency_framework_parameters(), |
|
1057 | 1057 | array( |
1058 | 1058 | 'id' => $id, |
1059 | - )); |
|
1059 | + ) ); |
|
1060 | 1060 | |
1061 | -$framework = api::read_framework($params['id']); |
|
1062 | -self::validate_context($framework->get_context()); |
|
1063 | -$output = $PAGE->get_renderer('tool_lp'); |
|
1061 | +$framework = api::read_framework( $params[ 'id' ] ); |
|
1062 | +self::validate_context( $framework->get_context() ); |
|
1063 | +$output = $PAGE->get_renderer( 'tool_lp' ); |
|
1064 | 1064 | |
1065 | 1065 | class Test123 |
1066 | 1066 | { |
@@ -1084,19 +1084,19 @@ discard block |
||
1084 | 1084 | } |
1085 | 1085 | |
1086 | 1086 | $foo = foo( |
1087 | - function () { |
|
1087 | + function() { |
|
1088 | 1088 | $foo->debug( |
1089 | 1089 | $a, |
1090 | 1090 | $b |
1091 | 1091 | ); |
1092 | 1092 | |
1093 | - if ($a) { |
|
1093 | + if ( $a ) { |
|
1094 | 1094 | $b = $a; |
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | ); |
1098 | 1098 | |
1099 | -if (somethingIsTrue()) { |
|
1099 | +if ( somethingIsTrue() ) { |
|
1100 | 1100 | ?> |
1101 | 1101 | <div> |
1102 | 1102 | <?php |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | 'bar' |
1108 | 1108 | ); |
1109 | 1109 | |
1110 | - if (somethingElseIsTrue()) { |
|
1110 | + if ( somethingElseIsTrue() ) { |
|
1111 | 1111 | doOneThing(); |
1112 | 1112 | } else { |
1113 | 1113 | doTheOtherThing(); |
@@ -1128,17 +1128,17 @@ discard block |
||
1128 | 1128 | ]; |
1129 | 1129 | |
1130 | 1130 | $foo = [ |
1131 | - function () { |
|
1132 | - if ($foo) { |
|
1131 | + function() { |
|
1132 | + if ( $foo ) { |
|
1133 | 1133 | return 'foo'; |
1134 | 1134 | } |
1135 | 1135 | }, |
1136 | 1136 | ]; |
1137 | 1137 | |
1138 | 1138 | $foo |
1139 | - ->bar(foo(function () { |
|
1140 | - }), foo(function () { |
|
1141 | - })); |
|
1139 | + ->bar( foo( function() { |
|
1140 | + }), foo( function() { |
|
1141 | + }) ); |
|
1142 | 1142 | |
1143 | 1143 | echo 'foo'; |
1144 | 1144 | |
@@ -1156,13 +1156,13 @@ discard block |
||
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | $foo = foo( |
1159 | - function () { |
|
1159 | + function() { |
|
1160 | 1160 | $foo->debug( |
1161 | 1161 | $a, |
1162 | 1162 | $b |
1163 | 1163 | ); |
1164 | 1164 | |
1165 | - if ($a) { |
|
1165 | + if ( $a ) { |
|
1166 | 1166 | $b = $a; |
1167 | 1167 | } |
1168 | 1168 | } |
@@ -1170,21 +1170,21 @@ discard block |
||
1170 | 1170 | |
1171 | 1171 | function test() |
1172 | 1172 | { |
1173 | - $array = []; |
|
1174 | - foreach ($array as $data) { |
|
1173 | + $array = [ ]; |
|
1174 | + foreach ( $array as $data ) { |
|
1175 | 1175 | [ |
1176 | 1176 | 'key1' => $var1, |
1177 | 1177 | 'key2' => $var2, |
1178 | 1178 | ] = $data; |
1179 | - foreach ($var1 as $method) { |
|
1179 | + foreach ( $var1 as $method ) { |
|
1180 | 1180 | echo $method . $var2; |
1181 | 1181 | } |
1182 | 1182 | } |
1183 | 1183 | } |
1184 | 1184 | |
1185 | -switch ($a) { |
|
1185 | +switch ( $a ) { |
|
1186 | 1186 | case 0: |
1187 | - $a = function () { |
|
1187 | + $a = function() { |
|
1188 | 1188 | }; |
1189 | 1189 | case 1: |
1190 | 1190 | break; |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | { |
1195 | 1195 | public function __construct() |
1196 | 1196 | { |
1197 | -if (false) { |
|
1197 | +if ( false ) { |
|
1198 | 1198 | echo 0; |
1199 | 1199 | } |
1200 | 1200 | } |
@@ -1209,11 +1209,11 @@ discard block |
||
1209 | 1209 | ], |
1210 | 1210 | |
1211 | 1211 | 'arrayWithArraysInThere' => [ |
1212 | - ['Value1', 'Value1'] |
|
1212 | + [ 'Value1', 'Value1' ] |
|
1213 | 1213 | ], |
1214 | 1214 | ]; |
1215 | 1215 | |
1216 | -switch ($sContext) { |
|
1216 | +switch ( $sContext ) { |
|
1217 | 1217 | case 'SOMETHING': |
1218 | 1218 | case 'CONSTANT': |
1219 | 1219 | do_something(); |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | array_map( |
1232 | - static function ( $item ) { |
|
1232 | + static function( $item ) { |
|
1233 | 1233 | echo $item; |
1234 | 1234 | }, |
1235 | 1235 | $some_array |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | /** |
1239 | 1239 | * Comment. |
1240 | 1240 | */ |
1241 | -$a(function () use ($app) { |
|
1241 | +$a( function() use ( $app ) { |
|
1242 | 1242 | echo 'hi'; |
1243 | 1243 | })(); |
1244 | 1244 | |
@@ -1246,17 +1246,17 @@ discard block |
||
1246 | 1246 | |
1247 | 1247 | function foo() |
1248 | 1248 | { |
1249 | - $foo('some |
|
1250 | - long description', function () { |
|
1249 | + $foo( 'some |
|
1250 | + long description', function() { |
|
1251 | 1251 | }); |
1252 | 1252 | |
1253 | - $foo('some |
|
1253 | + $foo( 'some |
|
1254 | 1254 | long |
1255 | - description', function () { |
|
1255 | + description', function() { |
|
1256 | 1256 | }); |
1257 | 1257 | |
1258 | 1258 | $foo( |
1259 | -'some long description', function () { |
|
1259 | +'some long description', function() { |
|
1260 | 1260 | }); |
1261 | 1261 | } |
1262 | 1262 | |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | function foo() { |
1309 | 1309 | echo 'foo'; |
1310 | 1310 | echo 'bar'; |
1311 | - if ($foo) { |
|
1311 | + if ( $foo ) { |
|
1312 | 1312 | echo 'baz'; |
1313 | 1313 | } |
1314 | 1314 | } |
@@ -1323,8 +1323,8 @@ discard block |
||
1323 | 1323 | ]; |
1324 | 1324 | } |
1325 | 1325 | |
1326 | -if ($foo) { |
|
1327 | -if ($oo) { |
|
1326 | +if ( $foo ) { |
|
1327 | +if ( $oo ) { |
|
1328 | 1328 | /* |
1329 | 1329 | * |
1330 | 1330 | * |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | $foo = array( |
1338 | 1338 | ); |
1339 | 1339 | |
1340 | - if ($foo) { |
|
1340 | + if ( $foo ) { |
|
1341 | 1341 | echo 'foo'; |
1342 | 1342 | } |
1343 | 1343 | |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | ?> |
1348 | 1348 | |
1349 | 1349 | <div> |
1350 | - <?php if ($foo) { |
|
1350 | + <?php if ( $foo ) { |
|
1351 | 1351 | echo $foo; |
1352 | 1352 | } ?> |
1353 | 1353 | </div> |
@@ -1362,18 +1362,18 @@ discard block |
||
1362 | 1362 | |
1363 | 1363 | <?php |
1364 | 1364 | |
1365 | -if (true) { |
|
1365 | +if ( true ) { |
|
1366 | 1366 | ?> |
1367 | 1367 | <div> |
1368 | 1368 | <?php |
1369 | 1369 | |
1370 | - if (true) { |
|
1370 | + if ( true ) { |
|
1371 | 1371 | ?> |
1372 | 1372 | <?php |
1373 | 1373 | } |
1374 | 1374 | |
1375 | - if (true |
|
1376 | - || false) { |
|
1375 | + if ( true |
|
1376 | + || false ) { |
|
1377 | 1377 | ?> |
1378 | 1378 | <?php |
1379 | 1379 | } |
@@ -1383,22 +1383,22 @@ discard block |
||
1383 | 1383 | <?php |
1384 | 1384 | } |
1385 | 1385 | |
1386 | -foo(function () { |
|
1387 | - if ($conditionA && |
|
1386 | +foo( function() { |
|
1387 | + if ( $conditionA && |
|
1388 | 1388 | $conditionB |
1389 | 1389 | ) { |
1390 | - if ($conditionC) { |
|
1390 | + if ( $conditionC ) { |
|
1391 | 1391 | $a = 1; |
1392 | 1392 | } |
1393 | 1393 | } |
1394 | 1394 | }); |
1395 | 1395 | |
1396 | -switch($foo) |
|
1396 | +switch ( $foo ) |
|
1397 | 1397 | { |
1398 | 1398 | case 1: |
1399 | 1399 | $value = 1; break; |
1400 | 1400 | case 2: |
1401 | - if ($bar) { |
|
1401 | + if ( $bar ) { |
|
1402 | 1402 | break; |
1403 | 1403 | } |
1404 | 1404 | default: |
@@ -1408,9 +1408,9 @@ discard block |
||
1408 | 1408 | ?> |
1409 | 1409 | |
1410 | 1410 | <?php |
1411 | - if (true) { |
|
1411 | + if ( true ) { |
|
1412 | 1412 | } |
1413 | - else if (true) { |
|
1413 | + else if ( true ) { |
|
1414 | 1414 | } |
1415 | 1415 | |
1416 | 1416 | $a = 1; |
@@ -2,18 +2,15 @@ discard block |
||
2 | 2 | <meta name="twitter:site" content="<?php echo $metaTagsData['twitter:site']; ?>"> |
3 | 3 | <?php |
4 | 4 | class Test { |
5 | - function __construct() |
|
6 | - { |
|
5 | + function __construct() { |
|
7 | 6 | $this->hello(); |
8 | 7 | } |
9 | 8 | |
10 | - function hello() |
|
11 | - { |
|
9 | + function hello() { |
|
12 | 10 | echo 'hello'; |
13 | 11 | }//end hello() |
14 | 12 | |
15 | - function hello2() |
|
16 | - { |
|
13 | + function hello2() { |
|
17 | 14 | if (TRUE) { |
18 | 15 | echo 'hello'; // no error here as its more than 4 spaces. |
19 | 16 | } else { |
@@ -29,8 +26,7 @@ discard block |
||
29 | 26 | } while (TRUE); |
30 | 27 | } |
31 | 28 | |
32 | - function hello3() |
|
33 | - { |
|
29 | + function hello3() { |
|
34 | 30 | switch ($hello) { |
35 | 31 | case 'hello': |
36 | 32 | break; |
@@ -51,18 +47,19 @@ discard block |
||
51 | 47 | </pre> |
52 | 48 | <?php |
53 | 49 | |
54 | -class Test2 |
|
55 | -{ |
|
56 | - function __construct() |
|
57 | - { |
|
50 | +class Test2 { |
|
51 | + function __construct() { |
|
58 | 52 | // $this->open(); // error here |
59 | 53 | } |
60 | 54 | |
61 | - public function open() |
|
62 | - { |
|
55 | + public function open() { |
|
63 | 56 | // Some inline stuff that shouldn't error |
64 | - if (TRUE) echo 'hello'; |
|
65 | - foreach ($tokens as $token) echo $token; |
|
57 | + if (TRUE) { |
|
58 | + echo 'hello'; |
|
59 | + } |
|
60 | + foreach ($tokens as $token) { |
|
61 | + echo $token; |
|
62 | + } |
|
66 | 63 | } |
67 | 64 | |
68 | 65 | /** |
@@ -71,8 +68,7 @@ discard block |
||
71 | 68 | * This is a comment 3. |
72 | 69 | * This is a comment 4. |
73 | 70 | */ |
74 | - public function close() |
|
75 | - { |
|
71 | + public function close() { |
|
76 | 72 | // All ok. |
77 | 73 | if (TRUE) { |
78 | 74 | if (TRUE) { |
@@ -130,8 +126,7 @@ discard block |
||
130 | 126 | |
131 | 127 | */ |
132 | 128 | |
133 | - public function read() |
|
134 | - { |
|
129 | + public function read() { |
|
135 | 130 | echo 'hello'; |
136 | 131 | |
137 | 132 | // no errors below. |
@@ -147,10 +142,8 @@ discard block |
||
147 | 142 | } |
148 | 143 | } |
149 | 144 | |
150 | -abstract class Test3 |
|
151 | -{ |
|
152 | - public function parse() |
|
153 | - { |
|
145 | +abstract class Test3 { |
|
146 | + public function parse() { |
|
154 | 147 | |
155 | 148 | foreach ($t as $ndx => $token) { |
156 | 149 | if (is_array($token)) { |
@@ -181,8 +174,7 @@ discard block |
||
181 | 174 | } |
182 | 175 | } |
183 | 176 | |
184 | -function test() |
|
185 | -{ |
|
177 | +function test() { |
|
186 | 178 | $o = <<<EOF |
187 | 179 | this is some text |
188 | 180 | this is some text |
@@ -217,8 +209,7 @@ discard block |
||
217 | 209 | this si something */ |
218 | 210 | } |
219 | 211 | |
220 | -function test() |
|
221 | -{ |
|
212 | +function test() { |
|
222 | 213 | /* taken from http://de3.php.net/manual/en/reserved.php */ |
223 | 214 | # $m[] = 'declare'; |
224 | 215 | /* taken from http://de3.php.net/manual/en/reserved.php */ |
@@ -303,8 +294,7 @@ discard block |
||
303 | 294 | return true; |
304 | 295 | } |
305 | 296 | |
306 | -function myFunction() |
|
307 | -{ |
|
297 | +function myFunction() { |
|
308 | 298 | ?> |
309 | 299 | <dynamic_content> |
310 | 300 | |
@@ -363,8 +353,7 @@ discard block |
||
363 | 353 | |
364 | 354 | // Testing anon function. |
365 | 355 | class a { |
366 | - function c() |
|
367 | - { |
|
356 | + function c() { |
|
368 | 357 | $this->doSomething( |
369 | 358 | function () { |
370 | 359 | echo 123; |
@@ -398,8 +387,7 @@ discard block |
||
398 | 387 | } |
399 | 388 | }; |
400 | 389 | |
401 | -class Whatever |
|
402 | -{ |
|
390 | +class Whatever { |
|
403 | 391 | protected $_protectedArray = array( |
404 | 392 | 'normalString' => 'That email address is already in use!', |
405 | 393 | 'offendingString' => <<<'STRING' |
@@ -411,10 +399,8 @@ discard block |
||
411 | 399 | ); |
412 | 400 | } |
413 | 401 | |
414 | -class MyClass |
|
415 | -{ |
|
416 | - public static function myFunction() |
|
417 | - { |
|
402 | +class MyClass { |
|
403 | + public static function myFunction() { |
|
418 | 404 | if (empty($keywords) === FALSE) { |
419 | 405 | $keywords = 'foo'; |
420 | 406 | $existing = 'foo'; |
@@ -436,10 +422,8 @@ discard block |
||
436 | 422 | } |
437 | 423 | ); |
438 | 424 | |
439 | -class AnonymousFn |
|
440 | -{ |
|
441 | - public function getAnonFn() |
|
442 | - { |
|
425 | +class AnonymousFn { |
|
426 | + public function getAnonFn() { |
|
443 | 427 | return array( |
444 | 428 | 'functions' => Array( |
445 | 429 | 'function1' => function ($a, $b, $c) { |
@@ -569,8 +553,7 @@ discard block |
||
569 | 553 | |
570 | 554 | $array = array(); |
571 | 555 | array_map( |
572 | - function($x) |
|
573 | - { |
|
556 | + function($x) { |
|
574 | 557 | return trim($x); |
575 | 558 | }, |
576 | 559 | $array |
@@ -580,8 +563,7 @@ discard block |
||
580 | 563 | |
581 | 564 | $mockedDatabase->expects($this->at(2)) |
582 | 565 | ->with($this->callback( |
583 | - function ($subject) |
|
584 | - { |
|
566 | + function ($subject) { |
|
585 | 567 | } |
586 | 568 | ) |
587 | 569 | ); |
@@ -593,8 +575,7 @@ discard block |
||
593 | 575 | ->appaend('bar') |
594 | 576 | ->appaend('baz') |
595 | 577 | ->outputUsing( |
596 | - function () |
|
597 | - { |
|
578 | + function () { |
|
598 | 579 | } |
599 | 580 | ); |
600 | 581 | |
@@ -662,8 +643,7 @@ discard block |
||
662 | 643 | <?php |
663 | 644 | } |
664 | 645 | |
665 | -function foo() |
|
666 | -{ |
|
646 | +function foo() { |
|
667 | 647 | $failingTests[$testName][] = array( |
668 | 648 | 'comment' => self::_replaceKeywords($failingComment, $result), |
669 | 649 | 'screenshot' => Test::getScreenshotPath( |
@@ -685,8 +665,7 @@ discard block |
||
685 | 665 | |
686 | 666 | $this->subject->recordLogin(); |
687 | 667 | |
688 | -function a() |
|
689 | -{ |
|
668 | +function a() { |
|
690 | 669 | if (true) { |
691 | 670 | static::$a[$b] = |
692 | 671 | static::where($c) |
@@ -732,8 +711,7 @@ discard block |
||
732 | 711 | ); |
733 | 712 | bar($foo); |
734 | 713 | |
735 | -class PHP_CodeSniffer_Tokenizers_JS |
|
736 | -{ |
|
714 | +class PHP_CodeSniffer_Tokenizers_JS { |
|
737 | 715 | |
738 | 716 | public $scopeOpeners = array( |
739 | 717 | T_CASE => array( |
@@ -751,8 +729,7 @@ discard block |
||
751 | 729 | appaend('bar')-> |
752 | 730 | appaend('baz')-> |
753 | 731 | outputUsing( |
754 | - function () |
|
755 | - { |
|
732 | + function () { |
|
756 | 733 | } |
757 | 734 | ); |
758 | 735 | |
@@ -794,13 +771,18 @@ discard block |
||
794 | 771 | elseif ($a == 6) : |
795 | 772 | echo "a equals 6"; |
796 | 773 | echo "!!!"; |
797 | -else : |
|
774 | +else { |
|
775 | + : |
|
798 | 776 | echo "a is neither 5 nor 6"; |
777 | +} |
|
799 | 778 | endif; |
800 | 779 | |
801 | 780 | if ($foo): |
802 | -if ($bar) $foo = 1; |
|
803 | -elseif ($baz) $foo = 2; |
|
781 | +if ($bar) { |
|
782 | + $foo = 1; |
|
783 | +} elseif ($baz) { |
|
784 | + $foo = 2; |
|
785 | +} |
|
804 | 786 | endif; |
805 | 787 | |
806 | 788 | $this |
@@ -810,15 +792,13 @@ discard block |
||
810 | 792 | 'foo' => 'bar', |
811 | 793 | )); |
812 | 794 | |
813 | -class Foo |
|
814 | -{ |
|
795 | +class Foo { |
|
815 | 796 | use Bar { |
816 | 797 | myMethod as renamedMethod; |
817 | 798 | } |
818 | 799 | } |
819 | 800 | |
820 | -class Foo |
|
821 | -{ |
|
801 | +class Foo { |
|
822 | 802 | use Bar { |
823 | 803 | myMethod as renamedMethod; |
824 | 804 | } |
@@ -853,14 +833,11 @@ discard block |
||
853 | 833 | } |
854 | 834 | } |
855 | 835 | |
856 | -class C0 |
|
857 | -{ |
|
858 | - public function m0() |
|
859 | - { |
|
836 | +class C0 { |
|
837 | + public function m0() { |
|
860 | 838 | } |
861 | 839 | |
862 | - public function m1() |
|
863 | - { |
|
840 | + public function m1() { |
|
864 | 841 | } |
865 | 842 | } |
866 | 843 | |
@@ -891,10 +868,8 @@ discard block |
||
891 | 868 | ]; |
892 | 869 | $c = 2; |
893 | 870 | |
894 | -class foo |
|
895 | -{ |
|
896 | - public function get() |
|
897 | - { |
|
871 | +class foo { |
|
872 | + public function get() { |
|
898 | 873 | $foo = ['b' => 'c', |
899 | 874 | 'd' => [ |
900 | 875 | ['e' => 'f'] |
@@ -984,10 +959,8 @@ discard block |
||
984 | 959 | ->getMock() |
985 | 960 | ); |
986 | 961 | |
987 | -class Foo |
|
988 | -{ |
|
989 | - public function setUp() |
|
990 | - { |
|
962 | +class Foo { |
|
963 | + public function setUp() { |
|
991 | 964 | $this->foo = new class { |
992 | 965 | public $name = 'Some value'; |
993 | 966 | }; |
@@ -1036,10 +1009,8 @@ discard block |
||
1036 | 1009 | return []; |
1037 | 1010 | } |
1038 | 1011 | |
1039 | -class SomeClass |
|
1040 | -{ |
|
1041 | - public function someFunc() |
|
1042 | - { |
|
1012 | +class SomeClass { |
|
1013 | + public function someFunc() { |
|
1043 | 1014 | a(function () { |
1044 | 1015 | echo "a"; |
1045 | 1016 | })->b(function () { |
@@ -1062,8 +1033,7 @@ discard block |
||
1062 | 1033 | self::validate_context($framework->get_context()); |
1063 | 1034 | $output = $PAGE->get_renderer('tool_lp'); |
1064 | 1035 | |
1065 | -class Test123 |
|
1066 | -{ |
|
1036 | +class Test123 { |
|
1067 | 1037 | protected static |
1068 | 1038 | $prop1 = [ |
1069 | 1039 | 'testA' => 123, |
@@ -1168,8 +1138,7 @@ discard block |
||
1168 | 1138 | } |
1169 | 1139 | ); |
1170 | 1140 | |
1171 | -function test() |
|
1172 | -{ |
|
1141 | +function test() { |
|
1173 | 1142 | $array = []; |
1174 | 1143 | foreach ($array as $data) { |
1175 | 1144 | [ |
@@ -1190,10 +1159,8 @@ discard block |
||
1190 | 1159 | break; |
1191 | 1160 | } |
1192 | 1161 | |
1193 | -class Test |
|
1194 | -{ |
|
1195 | - public function __construct() |
|
1196 | - { |
|
1162 | +class Test { |
|
1163 | + public function __construct() { |
|
1197 | 1164 | if (false) { |
1198 | 1165 | echo 0; |
1199 | 1166 | } |
@@ -1244,8 +1211,7 @@ discard block |
||
1244 | 1211 | |
1245 | 1212 | $app->run(); |
1246 | 1213 | |
1247 | -function foo() |
|
1248 | -{ |
|
1214 | +function foo() { |
|
1249 | 1215 | $foo('some |
1250 | 1216 | long description', function () { |
1251 | 1217 | }); |
@@ -1332,8 +1298,7 @@ discard block |
||
1332 | 1298 | } |
1333 | 1299 | } |
1334 | 1300 | |
1335 | - function foo() |
|
1336 | - { |
|
1301 | + function foo() { |
|
1337 | 1302 | $foo = array( |
1338 | 1303 | ); |
1339 | 1304 | |
@@ -1393,8 +1358,7 @@ discard block |
||
1393 | 1358 | } |
1394 | 1359 | }); |
1395 | 1360 | |
1396 | -switch($foo) |
|
1397 | -{ |
|
1361 | +switch($foo) { |
|
1398 | 1362 | case 1: |
1399 | 1363 | $value = 1; break; |
1400 | 1364 | case 2: |
@@ -1409,8 +1373,7 @@ discard block |
||
1409 | 1373 | |
1410 | 1374 | <?php |
1411 | 1375 | if (true) { |
1412 | - } |
|
1413 | - else if (true) { |
|
1376 | + } else if (true) { |
|
1414 | 1377 | } |
1415 | 1378 | |
1416 | 1379 | $a = 1; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | this is some text |
191 | 191 | this is some text |
192 | 192 | this is some text |
193 | -EOF; |
|
193 | +eof; |
|
194 | 194 | |
195 | 195 | return $o; |
196 | 196 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | no matter how many spaces are placed |
408 | 408 | at the beginning of each line |
409 | 409 | and the ending STRING on the next line is reported as having to be indented. |
410 | -STRING |
|
410 | +string |
|
411 | 411 | ); |
412 | 412 | } |
413 | 413 | |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | public function getAnonFn() |
442 | 442 | { |
443 | 443 | return array( |
444 | - 'functions' => Array( |
|
444 | + 'functions' => array( |
|
445 | 445 | 'function1' => function ($a, $b, $c) { |
446 | 446 | $a = $b + $c; |
447 | 447 | $b = $c / 2; |
448 | - return Array($a, $b, $c); |
|
448 | + return array($a, $b, $c); |
|
449 | 449 | }, |
450 | 450 | ), |
451 | 451 | ); |
@@ -1317,8 +1317,8 @@ discard block |
||
1317 | 1317 | function test() { |
1318 | 1318 | return [ |
1319 | 1319 | <<<'SQLDATA' |
1320 | -DATA |
|
1321 | -SQLDATA |
|
1320 | +data |
|
1321 | +sqldata |
|
1322 | 1322 | , |
1323 | 1323 | ]; |
1324 | 1324 | } |
@@ -11,17 +11,17 @@ discard block |
||
11 | 11 | this is some text |
12 | 12 | EOF; |
13 | 13 | |
14 | - $correctVar = true; |
|
14 | + $correctVar = true; |
|
15 | 15 | $correctVar = false; |
16 | 16 | |
17 | 17 | class MyClass |
18 | 18 | { |
19 | - /** |
|
19 | + /** |
|
20 | 20 | * Short description. |
21 | 21 | * |
22 | 22 | * @return void |
23 | 23 | */ |
24 | - public function myFunction() { } |
|
24 | + public function myFunction() { } |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $str = 'hello |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | </html> |
52 | 52 | |
53 | 53 | <?php |
54 | - // Issue #1404 |
|
55 | - // This is a line with mixed tabs and spaces. |
|
56 | - echo 'And here is another line with mixed tabs and spaces.'; |
|
57 | - echo 'And another one.'; |
|
58 | - echo 'And another one.'; |
|
59 | - echo 'And another one.'; |
|
54 | + // Issue #1404 |
|
55 | + // This is a line with mixed tabs and spaces. |
|
56 | + echo 'And here is another line with mixed tabs and spaces.'; |
|
57 | + echo 'And another one.'; |
|
58 | + echo 'And another one.'; |
|
59 | + echo 'And another one.'; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * This doc block should be fine and should be ignored for metrics. |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | Another line. |
69 | 69 | */ |
70 | 70 | |
71 | - /** |
|
72 | - * This PHP DocBlock is indented with spaces; metrics should say spaces. |
|
73 | - */ |
|
71 | + /** |
|
72 | + * This PHP DocBlock is indented with spaces; metrics should say spaces. |
|
73 | + */ |
|
74 | 74 | |
75 | - /* |
|
75 | + /* |
|
76 | 76 | * This multi-line comment is indented with spaces; metrics should say spaces. |
77 | 77 | */ |
78 | 78 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | class ExampleClass |
4 | 4 | { |
5 | - function exampleFunction() {} |
|
5 | + function exampleFunction() {} |
|
6 | 6 | |
7 | 7 | } |
8 | 8 |
@@ -1,7 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class ExampleClass |
|
4 | -{ |
|
3 | +class ExampleClass { |
|
5 | 4 | function exampleFunction() {} |
6 | 5 | |
7 | 6 | } |
@@ -14,8 +13,7 @@ discard block |
||
14 | 13 | $correctVar = true; |
15 | 14 | $correctVar = false; |
16 | 15 | |
17 | -class MyClass |
|
18 | -{ |
|
16 | +class MyClass { |
|
19 | 17 | /** |
20 | 18 | * Short description. |
21 | 19 | * |
@@ -9,7 +9,7 @@ |
||
9 | 9 | $o = <<<EOF |
10 | 10 | this is some text |
11 | 11 | this is some text |
12 | -EOF; |
|
12 | +eof; |
|
13 | 13 | |
14 | 14 | $correctVar = true; |
15 | 15 | $correctVar = false; |