@@ -1,27 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ($something) echo 'hello'; |
|
3 | +if ($something) { |
|
4 | + echo 'hello'; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | if ($something) { |
6 | 8 | echo 'hello'; |
7 | -} else echo 'hi'; |
|
9 | +} else { |
|
10 | + echo 'hi'; |
|
11 | +} |
|
8 | 12 | |
9 | 13 | if ($something) { |
10 | 14 | echo 'hello'; |
11 | -} else if ($else) echo 'hi'; |
|
15 | +} else if ($else) { |
|
16 | + echo 'hi'; |
|
17 | +} |
|
12 | 18 | |
13 | -foreach ($something as $thing) echo 'hello'; |
|
19 | +foreach ($something as $thing) { |
|
20 | + echo 'hello'; |
|
21 | +} |
|
14 | 22 | |
15 | -for ($i; $i > 0; $i--) echo 'hello'; |
|
23 | +for ($i; $i > 0; $i--) { |
|
24 | + echo 'hello'; |
|
25 | +} |
|
16 | 26 | |
17 | -while ($something) echo 'hello'; |
|
27 | +while ($something) { |
|
28 | + echo 'hello'; |
|
29 | +} |
|
18 | 30 | |
19 | 31 | do { |
20 | 32 | $i--; |
21 | 33 | } while ($something); |
22 | 34 | |
23 | -if(true) |
|
35 | +if(true) { |
|
24 | 36 | $someObject->{$name}; |
37 | +} |
|
25 | 38 | |
26 | 39 | if (true) : |
27 | 40 | $foo = true; |
@@ -42,31 +55,37 @@ discard block |
||
42 | 55 | while (!$this->readLine($tokens, $tag)); |
43 | 56 | while (!$this->readLine($tokens, $tag)); //skip to end of file |
44 | 57 | |
45 | -foreach ($cookies as $cookie) |
|
58 | +foreach ($cookies as $cookie) { |
|
46 | 59 | if ($cookie->match($uri, $matchSessionCookies, $now)) |
47 | 60 | $ret[] = $cookie; |
61 | +} |
|
48 | 62 | |
49 | -foreach ($stringParade as $hit) |
|
50 | - $hitParade[] = $hit + 0; //cast to integer |
|
63 | +foreach ($stringParade as $hit) { |
|
64 | + $hitParade[] = $hit + 0; |
|
65 | +} |
|
66 | +//cast to integer |
|
51 | 67 | |
52 | 68 | if ($foo) : |
53 | 69 | echo 'true'; |
54 | 70 | elseif ($something) : |
55 | 71 | echo 'foo'; |
56 | -else: |
|
72 | +else { |
|
73 | + : |
|
57 | 74 | echo 'false'; |
75 | +} |
|
58 | 76 | endif; |
59 | 77 | |
60 | -function test() |
|
61 | -{ |
|
62 | - if ($a) |
|
63 | - $a.=' '.($b ? 'b' : ($c ? ($d ? 'd' : 'c') : '')); |
|
64 | -} |
|
78 | +function test() { |
|
79 | + if ($a) { |
|
80 | + $a.=' '.($b ? 'b' : ($c ? ($d ? 'd' : 'c') : '')); |
|
81 | + } |
|
82 | + } |
|
65 | 83 | |
66 | -if ($a) |
|
84 | +if ($a) { |
|
67 | 85 | foreach ($b as $c) { |
68 | 86 | if ($d) { |
69 | 87 | $e=$f; |
88 | +} |
|
70 | 89 | $g=$h; |
71 | 90 | } elseif ($i==0) { |
72 | 91 | $j=$k; |
@@ -75,7 +94,8 @@ discard block |
||
75 | 94 | |
76 | 95 | ?> |
77 | 96 | <div style="text-align: right;"> |
78 | - <?php if ($model->scenario == 'simple') $widget->renderPager() ?> |
|
97 | + <?php if ($model->scenario == 'simple') { |
|
98 | + $widget->renderPager() ?> |
|
79 | 99 | </div> |
80 | 100 | |
81 | 101 | <?php |
@@ -83,6 +103,7 @@ discard block |
||
83 | 103 | case Shop_Customer :: ERROR_INVALID_GENDER: ?> |
84 | 104 | Ungültiges Geschlecht! |
85 | 105 | <?php break; |
106 | +} |
|
86 | 107 | case Shop_Customer :: ERROR_EMAIL_IN_USE: ?> |
87 | 108 | Die eingetragene E-Mail-Adresse ist bereits registriert. |
88 | 109 | <?php break; |
@@ -95,8 +116,10 @@ discard block |
||
95 | 116 | echo 'foo'; |
96 | 117 | endswitch; |
97 | 118 | endif; |
98 | -else: |
|
119 | +else { |
|
120 | + : |
|
99 | 121 | echo 'foo'; |
122 | +} |
|
100 | 123 | endif; |
101 | 124 | |
102 | 125 | // ELSE IF split over multiple lines (not inline) |
@@ -117,85 +140,109 @@ discard block |
||
117 | 140 | } |
118 | 141 | |
119 | 142 | $stuff = [1,2,3]; |
120 | -foreach($stuff as $num) |
|
143 | +foreach($stuff as $num) { |
|
121 | 144 | if ($num %2 ) { |
122 | 145 | echo "even"; |
146 | +} |
|
123 | 147 | } else { |
124 | 148 | echo "odd"; |
125 | 149 | } |
126 | 150 | |
127 | 151 | $i = 0; |
128 | -foreach($stuff as $num) |
|
152 | +foreach($stuff as $num) { |
|
129 | 153 | do { |
130 | 154 | echo $i; |
155 | +} |
|
131 | 156 | $i++; |
132 | 157 | } while ($i < 5); |
133 | 158 | |
134 | -foreach($stuff as $num) |
|
159 | +foreach($stuff as $num) { |
|
135 | 160 | if (true) { |
136 | 161 | echo "true1\n"; |
162 | +} |
|
137 | 163 | } |
138 | 164 | if (true) { |
139 | 165 | echo "true2\n"; |
140 | 166 | } |
141 | 167 | |
142 | -if ($foo) echo 'foo'; |
|
143 | -elseif ($bar) echo 'bar'; |
|
144 | -else echo 'baz'; |
|
168 | +if ($foo) { |
|
169 | + echo 'foo'; |
|
170 | +} elseif ($bar) { |
|
171 | + echo 'bar'; |
|
172 | +} else { |
|
173 | + echo 'baz'; |
|
174 | +} |
|
145 | 175 | |
146 | 176 | switch ($type) { |
147 | 177 | case 1: |
148 | 178 | if ($foo) { |
149 | 179 | return true; |
150 | - } elseif ($baz) |
|
151 | - return true; |
|
152 | - else { |
|
180 | + } elseif ($baz) { |
|
181 | + return true; |
|
182 | + } else { |
|
153 | 183 | echo 'else'; |
154 | 184 | } |
155 | 185 | break; |
156 | 186 | } |
157 | 187 | |
158 | -foreach ($sql as $s) |
|
188 | +foreach ($sql as $s) { |
|
159 | 189 | if (!$this->execute) echo "<pre>",$s.";\n</pre>"; |
190 | +} |
|
160 | 191 | else { |
161 | 192 | $ok = $this->connDest->Execute($s); |
162 | - if (!$ok) |
|
163 | - if ($this->neverAbort) $ret = false; |
|
164 | - else return false; |
|
193 | + if (!$ok) { |
|
194 | + if ($this->neverAbort) $ret = false; |
|
195 | + } else { |
|
196 | + return false; |
|
197 | + } |
|
165 | 198 | } |
166 | 199 | |
167 | -if ($bar) |
|
168 | - if ($foo) echo 'hi'; // lol |
|
200 | +if ($bar) { |
|
201 | + if ($foo) echo 'hi'; |
|
202 | +} |
|
203 | +// lol |
|
169 | 204 | |
170 | -if ($level == 'district') |
|
205 | +if ($level == 'district') { |
|
171 | 206 | \DB::update(<<<EOD |
172 | 207 | some |
173 | 208 | text |
174 | 209 | here |
175 | 210 | EOD |
176 | 211 | ); |
212 | +} |
|
177 | 213 | |
178 | -if ($level == 'district') |
|
214 | +if ($level == 'district') { |
|
179 | 215 | $var = <<<EOD |
180 | 216 | some |
181 | 217 | text |
182 | 218 | here |
183 | 219 | EOD; |
220 | +} |
|
184 | 221 | |
185 | -if ($a && $a === Foo::VARIABLE && ($a === Foo::METHOD || $a === Foo::FUNCTION)) |
|
222 | +if ($a && $a === Foo::VARIABLE && ($a === Foo::METHOD || $a === Foo::FUNCTION)) { |
|
186 | 223 | echo 'hi'; |
224 | +} |
|
187 | 225 | |
188 | -$out = array_map(function ($test) { if ($test) return 1; else return 2; }, $input); // comment |
|
226 | +$out = array_map(function ($test) { if ($test) { |
|
227 | + return 1; |
|
228 | +} else { |
|
229 | + return 2; |
|
230 | +} |
|
231 | +}, $input); // comment |
|
189 | 232 | |
190 | 233 | for ($x=0;$x<5;$x++): |
191 | - if ($x) continue; |
|
192 | -endfor; |
|
234 | + if ($x) { |
|
235 | + continue; |
|
236 | + } |
|
237 | + endfor; |
|
193 | 238 | |
194 | 239 | for ($x=0;$x<5;$x++): |
195 | - if ($x) continue ?> <?php |
|
240 | + if ($x) { |
|
241 | + continue ?> <?php |
|
196 | 242 | endfor; |
243 | + } |
|
197 | 244 | |
198 | -if (true) |
|
245 | +if (true) { |
|
199 | 246 | try { |
200 | 247 | } |
201 | 248 | catch(Exception $e) { |
@@ -209,6 +256,7 @@ discard block |
||
209 | 256 | "foobarbaz" |
210 | 257 | ) |
211 | 258 | ); |
259 | +} |
|
212 | 260 | break; |
213 | 261 | } |
214 | 262 | |
@@ -219,9 +267,10 @@ discard block |
||
219 | 267 | while ($i < 10); |
220 | 268 | |
221 | 269 | if ($this) { |
222 | - if ($that) |
|
223 | - foo(${$a[$b]}); |
|
224 | -} |
|
270 | + if ($that) { |
|
271 | + foo(${$a[$b]}); |
|
272 | + } |
|
273 | + } |
|
225 | 274 | |
226 | 275 | while (!$this->readLine($tokens, $tag)); //phpcs:ignore Standard.Category.Sniff |
227 | 276 | |
@@ -229,12 +278,18 @@ discard block |
||
229 | 278 | |
230 | 279 | while (!$this->readLine($tokens, $tag)); /* comment */ |
231 | 280 | |
232 | -foreach ($stringParade as $hit) |
|
233 | - $hitParade[] = $hit + 0; // phpcs:ignore Standard.Category.Sniff |
|
281 | +foreach ($stringParade as $hit) { |
|
282 | + $hitParade[] = $hit + 0; |
|
283 | +} |
|
284 | +// phpcs:ignore Standard.Category.Sniff |
|
234 | 285 | |
235 | -if ($bar) |
|
236 | - if ($foo) echo 'hi'; /* @phpcs:ignore Standard.Category.Sniff */ |
|
286 | +if ($bar) { |
|
287 | + if ($foo) echo 'hi'; |
|
288 | +} |
|
289 | +/* @phpcs:ignore Standard.Category.Sniff */ |
|
237 | 290 | |
238 | -if (true) $callable = function () { |
|
291 | +if (true) { |
|
292 | + $callable = function () { |
|
239 | 293 | return true; |
294 | +} |
|
240 | 295 | }; |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class InlineControlStructureUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class InlineControlStructureUnitTest extends AbstractSniffUnitTest { |
|
16 | 15 | |
17 | 16 | |
18 | 17 | /** |
@@ -25,8 +24,7 @@ discard block |
||
25 | 24 | * |
26 | 25 | * @return array<int, int> |
27 | 26 | */ |
28 | - public function getErrorList($testFile='InlineControlStructureUnitTest.1.inc') |
|
29 | - { |
|
27 | + public function getErrorList($testFile='InlineControlStructureUnitTest.1.inc') { |
|
30 | 28 | switch ($testFile) { |
31 | 29 | case 'InlineControlStructureUnitTest.1.inc': |
32 | 30 | return [ |
@@ -104,8 +102,7 @@ discard block |
||
104 | 102 | * |
105 | 103 | * @return array<int, int> |
106 | 104 | */ |
107 | - public function getWarningList() |
|
108 | - { |
|
105 | + public function getWarningList() { |
|
109 | 106 | return []; |
110 | 107 | |
111 | 108 | }//end getWarningList() |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class UpperCaseConstantNameUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class UpperCaseConstantNameUnitTest 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 | 8 => 1, |
30 | 28 | 10 => 1, |
@@ -46,8 +44,7 @@ discard block |
||
46 | 44 | * |
47 | 45 | * @return array<int, int> |
48 | 46 | */ |
49 | - public function getWarningList() |
|
50 | - { |
|
47 | + public function getWarningList() { |
|
51 | 48 | return []; |
52 | 49 | |
53 | 50 | }//end getWarningList() |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class ConstructorNameUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class ConstructorNameUnitTest 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 | 6 => 1, |
30 | 28 | 11 => 1, |
@@ -44,8 +42,7 @@ discard block |
||
44 | 42 | * |
45 | 43 | * @return array<int, int> |
46 | 44 | */ |
47 | - public function getWarningList() |
|
48 | - { |
|
45 | + public function getWarningList() { |
|
49 | 46 | return []; |
50 | 47 | |
51 | 48 | }//end getWarningList() |
@@ -1,6 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -class TestClass extends MyClass |
|
3 | -{ |
|
2 | +class TestClass extends MyClass { |
|
4 | 3 | |
5 | 4 | function TestClass() { |
6 | 5 | parent::MyClass(); |
@@ -14,8 +13,7 @@ discard block |
||
14 | 13 | |
15 | 14 | } |
16 | 15 | |
17 | -class MyClass |
|
18 | -{ |
|
16 | +class MyClass { |
|
19 | 17 | |
20 | 18 | function MyClass() { |
21 | 19 | parent::YourClass(); |
@@ -29,29 +27,24 @@ discard block |
||
29 | 27 | |
30 | 28 | } |
31 | 29 | |
32 | -class MyOtherClass extends \MyNamespace\SomeClass |
|
33 | -{ |
|
30 | +class MyOtherClass extends \MyNamespace\SomeClass { |
|
34 | 31 | function __construct() { |
35 | 32 | something::MyNamespace(); |
36 | 33 | } |
37 | 34 | |
38 | 35 | } |
39 | 36 | |
40 | -abstract class MyAbstractClass extends \MyNamespace\SomeClass |
|
41 | -{ |
|
37 | +abstract class MyAbstractClass extends \MyNamespace\SomeClass { |
|
42 | 38 | abstract public function __construct(); |
43 | 39 | } |
44 | 40 | |
45 | -class OldClass |
|
46 | -{ |
|
47 | - function OldClass() |
|
48 | - { |
|
41 | +class OldClass { |
|
42 | + function OldClass() { |
|
49 | 43 | |
50 | 44 | } |
51 | 45 | } |
52 | 46 | |
53 | -foo(new class extends MyClass |
|
54 | -{ |
|
47 | +foo(new class extends MyClass { |
|
55 | 48 | |
56 | 49 | function TestClass() { |
57 | 50 | parent::MyClass(); |
@@ -65,8 +58,7 @@ discard block |
||
65 | 58 | |
66 | 59 | }); |
67 | 60 | |
68 | -class OlderClass |
|
69 | -{ |
|
61 | +class OlderClass { |
|
70 | 62 | function OlderClass() {} |
71 | 63 | |
72 | 64 | function __CONSTRUCT() {} |
@@ -84,14 +84,12 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | /* @codingStandardsIgnoreStart */ |
87 | -class MyClass |
|
88 | -{ |
|
87 | +class MyClass { |
|
89 | 88 | /* @codingStandardsIgnoreEnd */ |
90 | 89 | public function __construct() {} |
91 | 90 | } |
92 | 91 | |
93 | -trait Foo |
|
94 | -{ |
|
92 | +trait Foo { |
|
95 | 93 | function __call($name, $args) {} |
96 | 94 | } |
97 | 95 | |
@@ -102,8 +100,7 @@ discard block |
||
102 | 100 | } |
103 | 101 | function __autoLoad($class) {} |
104 | 102 | |
105 | -class Foo extends \SoapClient |
|
106 | -{ |
|
103 | +class Foo extends \SoapClient { |
|
107 | 104 | public function __soapCall( |
108 | 105 | $functionName, |
109 | 106 | $arguments, |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class CamelCapsFunctionNameUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class CamelCapsFunctionNameUnitTest 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 | $errors = [ |
29 | 27 | 10 => 1, |
30 | 28 | 11 => 1, |
@@ -78,8 +76,7 @@ discard block |
||
78 | 76 | * |
79 | 77 | * @return array<int, int> |
80 | 78 | */ |
81 | - public function getWarningList() |
|
82 | - { |
|
79 | + public function getWarningList() { |
|
83 | 80 | return []; |
84 | 81 | |
85 | 82 | }//end getWarningList() |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | use PHP_CodeSniffer\Config; |
14 | 14 | |
15 | -class CSSLintUnitTest extends AbstractSniffUnitTest |
|
16 | -{ |
|
15 | +class CSSLintUnitTest extends AbstractSniffUnitTest { |
|
17 | 16 | |
18 | 17 | |
19 | 18 | /** |
@@ -21,8 +20,7 @@ discard block |
||
21 | 20 | * |
22 | 21 | * @return void |
23 | 22 | */ |
24 | - protected function shouldSkipTest() |
|
25 | - { |
|
23 | + protected function shouldSkipTest() { |
|
26 | 24 | $csslintPath = Config::getExecutablePath('csslint'); |
27 | 25 | if ($csslintPath === null) { |
28 | 26 | return true; |
@@ -41,8 +39,7 @@ discard block |
||
41 | 39 | * |
42 | 40 | * @return array<int, int> |
43 | 41 | */ |
44 | - public function getErrorList() |
|
45 | - { |
|
42 | + public function getErrorList() { |
|
46 | 43 | return []; |
47 | 44 | |
48 | 45 | }//end getErrorList() |
@@ -56,8 +53,7 @@ discard block |
||
56 | 53 | * |
57 | 54 | * @return array<int, int> |
58 | 55 | */ |
59 | - public function getWarningList() |
|
60 | - { |
|
56 | + public function getWarningList() { |
|
61 | 57 | return [ |
62 | 58 | 3 => 1, |
63 | 59 | 4 => 1, |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | use PHP_CodeSniffer\Config; |
14 | 14 | |
15 | -class JSHintUnitTest extends AbstractSniffUnitTest |
|
16 | -{ |
|
15 | +class JSHintUnitTest extends AbstractSniffUnitTest { |
|
17 | 16 | |
18 | 17 | |
19 | 18 | /** |
@@ -21,8 +20,7 @@ discard block |
||
21 | 20 | * |
22 | 21 | * @return void |
23 | 22 | */ |
24 | - protected function shouldSkipTest() |
|
25 | - { |
|
23 | + protected function shouldSkipTest() { |
|
26 | 24 | $rhinoPath = Config::getExecutablePath('rhino'); |
27 | 25 | $jshintPath = Config::getExecutablePath('jshint'); |
28 | 26 | if ($rhinoPath === null && $jshintPath === null) { |
@@ -42,8 +40,7 @@ discard block |
||
42 | 40 | * |
43 | 41 | * @return array<int, int> |
44 | 42 | */ |
45 | - public function getErrorList() |
|
46 | - { |
|
43 | + public function getErrorList() { |
|
47 | 44 | return []; |
48 | 45 | |
49 | 46 | }//end getErrorList() |
@@ -57,8 +54,7 @@ discard block |
||
57 | 54 | * |
58 | 55 | * @return array<int, int> |
59 | 56 | */ |
60 | - public function getWarningList() |
|
61 | - { |
|
57 | + public function getWarningList() { |
|
62 | 58 | return [3 => 2]; |
63 | 59 | |
64 | 60 | }//end getWarningList() |