@@ -1,29 +1,29 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class Foo { |
4 | - public final function fooBar() {} |
|
5 | - protected final function fool() {} |
|
6 | - private final function Bar() {} |
|
4 | + public final function fooBar() {} |
|
5 | + protected final function fool() {} |
|
6 | + private final function Bar() {} |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | final class Foo_Bar { |
10 | - public $foobar; |
|
11 | - public final $FOOBAR = 23; // Parse error, but that's not the concern of this sniff, so report it. |
|
12 | - public final function fooBar() {} |
|
10 | + public $foobar; |
|
11 | + public final $FOOBAR = 23; // Parse error, but that's not the concern of this sniff, so report it. |
|
12 | + public final function fooBar() {} |
|
13 | 13 | |
14 | - protected function foo() {} |
|
15 | - protected final function fool() {} |
|
14 | + protected function foo() {} |
|
15 | + protected final function fool() {} |
|
16 | 16 | |
17 | - private function Bar() {} |
|
18 | - private final function Bard() {} |
|
17 | + private function Bar() {} |
|
18 | + private final function Bard() {} |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | final class Bar_Foo { |
22 | - public $foobar; |
|
23 | - protected $foo; |
|
24 | - private $bar; |
|
22 | + public $foobar; |
|
23 | + protected $foo; |
|
24 | + private $bar; |
|
25 | 25 | |
26 | - public function fooBar() {} |
|
27 | - protected function foo() {} |
|
28 | - private function Bar() {} |
|
26 | + public function fooBar() {} |
|
27 | + protected function foo() {} |
|
28 | + private function Bar() {} |
|
29 | 29 | } |
@@ -1,25 +1,25 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | for ($i = 0; $i < 20; $i++) { |
4 | - for ($j = 0; $j < 5; $i += 2) { |
|
5 | - for ($k = 0; $k > 3; $i++) { |
|
4 | + for ($j = 0; $j < 5; $i += 2) { |
|
5 | + for ($k = 0; $k > 3; $i++) { |
|
6 | 6 | |
7 | - } |
|
8 | - } |
|
7 | + } |
|
8 | + } |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | for ($i = 0; $i < 20; $i++) { |
12 | - for ($j = 0; $j < 5; $j += 2) { |
|
13 | - for ($k = 0; $k > 3; $k++) { |
|
12 | + for ($j = 0; $j < 5; $j += 2) { |
|
13 | + for ($k = 0; $k > 3; $k++) { |
|
14 | 14 | |
15 | - } |
|
16 | - } |
|
15 | + } |
|
16 | + } |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | for ($i = 0; $i < 20; $i++) { |
20 | - for ($j = 0; $j < 5; $j += 2) { |
|
21 | - for ($k = 0; $k > 3; $j++) { |
|
20 | + for ($j = 0; $j < 5; $j += 2) { |
|
21 | + for ($k = 0; $k > 3; $j++) { |
|
22 | 22 | |
23 | - } |
|
24 | - } |
|
23 | + } |
|
24 | + } |
|
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -1,24 +1,24 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -for ($i = 0; $i < 20; $i++) { |
|
4 | - for ($j = 0; $j < 5; $i += 2) { |
|
5 | - for ($k = 0; $k > 3; $i++) { |
|
3 | +for ( $i = 0; $i < 20; $i++ ) { |
|
4 | + for ( $j = 0; $j < 5; $i += 2 ) { |
|
5 | + for ( $k = 0; $k > 3; $i++ ) { |
|
6 | 6 | |
7 | 7 | } |
8 | 8 | } |
9 | 9 | } |
10 | 10 | |
11 | -for ($i = 0; $i < 20; $i++) { |
|
12 | - for ($j = 0; $j < 5; $j += 2) { |
|
13 | - for ($k = 0; $k > 3; $k++) { |
|
11 | +for ( $i = 0; $i < 20; $i++ ) { |
|
12 | + for ( $j = 0; $j < 5; $j += 2 ) { |
|
13 | + for ( $k = 0; $k > 3; $k++ ) { |
|
14 | 14 | |
15 | 15 | } |
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
19 | -for ($i = 0; $i < 20; $i++) { |
|
20 | - for ($j = 0; $j < 5; $j += 2) { |
|
21 | - for ($k = 0; $k > 3; $j++) { |
|
19 | +for ( $i = 0; $i < 20; $i++ ) { |
|
20 | + for ( $j = 0; $j < 5; $j += 2 ) { |
|
21 | + for ( $k = 0; $k > 3; $j++ ) { |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | } |
@@ -15,37 +15,37 @@ |
||
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 | - |
|
30 | - }//end getErrorList() |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * Returns the lines where warnings should occur. |
|
35 | - * |
|
36 | - * The key of the array should represent the line number and the value |
|
37 | - * should represent the number of warnings that should occur on that line. |
|
38 | - * |
|
39 | - * @return array<int, int> |
|
40 | - */ |
|
41 | - public function getWarningList() |
|
42 | - { |
|
43 | - return [ |
|
44 | - 6 => 1, |
|
45 | - 10 => 1, |
|
46 | - ]; |
|
47 | - |
|
48 | - }//end getWarningList() |
|
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 | + |
|
30 | + }//end getErrorList() |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * Returns the lines where warnings should occur. |
|
35 | + * |
|
36 | + * The key of the array should represent the line number and the value |
|
37 | + * should represent the number of warnings that should occur on that line. |
|
38 | + * |
|
39 | + * @return array<int, int> |
|
40 | + */ |
|
41 | + public function getWarningList() |
|
42 | + { |
|
43 | + return [ |
|
44 | + 6 => 1, |
|
45 | + 10 => 1, |
|
46 | + ]; |
|
47 | + |
|
48 | + }//end getWarningList() |
|
49 | 49 | |
50 | 50 | |
51 | 51 | }//end class |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class ForLoopShouldBeWhileLoopUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class ForLoopShouldBeWhileLoopUnitTest 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 | |
30 | 28 | }//end getErrorList() |
@@ -38,8 +36,7 @@ discard block |
||
38 | 36 | * |
39 | 37 | * @return array<int, int> |
40 | 38 | */ |
41 | - public function getWarningList() |
|
42 | - { |
|
39 | + public function getWarningList() { |
|
43 | 40 | return [ |
44 | 41 | 6 => 1, |
45 | 42 | 10 => 1, |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function getErrorList() |
27 | 27 | { |
28 | - return []; |
|
28 | + return [ ]; |
|
29 | 29 | |
30 | 30 | }//end getErrorList() |
31 | 31 |
@@ -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 []; |
|
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 | 29 | |
30 | - }//end getErrorList() |
|
30 | + }//end getErrorList() |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * Returns the lines where warnings should occur. |
|
35 | - * |
|
36 | - * The key of the array should represent the line number and the value |
|
37 | - * should represent the number of warnings that should occur on that line. |
|
38 | - * |
|
39 | - * @return array<int, int> |
|
40 | - */ |
|
41 | - public function getWarningList() |
|
42 | - { |
|
43 | - return [ |
|
44 | - 46 => 1, |
|
45 | - 47 => 1, |
|
46 | - 48 => 1, |
|
47 | - 49 => 1, |
|
48 | - 50 => 1, |
|
49 | - 51 => 1, |
|
50 | - 52 => 1, |
|
51 | - 53 => 1, |
|
52 | - 54 => 1, |
|
53 | - 55 => 1, |
|
54 | - 56 => 1, |
|
55 | - 57 => 1, |
|
56 | - 58 => 1, |
|
57 | - 59 => 1, |
|
58 | - 60 => 1, |
|
59 | - 61 => 2, |
|
60 | - 63 => 1, |
|
61 | - 64 => 1, |
|
62 | - 67 => 1, |
|
63 | - 68 => 1, |
|
64 | - 69 => 1, |
|
65 | - 70 => 1, |
|
66 | - 71 => 1, |
|
67 | - 72 => 1, |
|
68 | - 73 => 1, |
|
69 | - 75 => 1, |
|
70 | - 77 => 1, |
|
71 | - 80 => 2, |
|
72 | - 84 => 1, |
|
73 | - 85 => 2, |
|
74 | - 88 => 1, |
|
75 | - 90 => 1, |
|
76 | - 92 => 1, |
|
77 | - ]; |
|
33 | + /** |
|
34 | + * Returns the lines where warnings should occur. |
|
35 | + * |
|
36 | + * The key of the array should represent the line number and the value |
|
37 | + * should represent the number of warnings that should occur on that line. |
|
38 | + * |
|
39 | + * @return array<int, int> |
|
40 | + */ |
|
41 | + public function getWarningList() |
|
42 | + { |
|
43 | + return [ |
|
44 | + 46 => 1, |
|
45 | + 47 => 1, |
|
46 | + 48 => 1, |
|
47 | + 49 => 1, |
|
48 | + 50 => 1, |
|
49 | + 51 => 1, |
|
50 | + 52 => 1, |
|
51 | + 53 => 1, |
|
52 | + 54 => 1, |
|
53 | + 55 => 1, |
|
54 | + 56 => 1, |
|
55 | + 57 => 1, |
|
56 | + 58 => 1, |
|
57 | + 59 => 1, |
|
58 | + 60 => 1, |
|
59 | + 61 => 2, |
|
60 | + 63 => 1, |
|
61 | + 64 => 1, |
|
62 | + 67 => 1, |
|
63 | + 68 => 1, |
|
64 | + 69 => 1, |
|
65 | + 70 => 1, |
|
66 | + 71 => 1, |
|
67 | + 72 => 1, |
|
68 | + 73 => 1, |
|
69 | + 75 => 1, |
|
70 | + 77 => 1, |
|
71 | + 80 => 2, |
|
72 | + 84 => 1, |
|
73 | + 85 => 2, |
|
74 | + 88 => 1, |
|
75 | + 90 => 1, |
|
76 | + 92 => 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 AssignmentInConditionUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class AssignmentInConditionUnitTest 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 | |
30 | 28 | }//end getErrorList() |
@@ -38,8 +36,7 @@ discard block |
||
38 | 36 | * |
39 | 37 | * @return array<int, int> |
40 | 38 | */ |
41 | - public function getWarningList() |
|
42 | - { |
|
39 | + public function getWarningList() { |
|
43 | 40 | return [ |
44 | 41 | 46 => 1, |
45 | 42 | 47 => 1, |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function getErrorList() |
27 | 27 | { |
28 | - return []; |
|
28 | + return [ ]; |
|
29 | 29 | |
30 | 30 | }//end getErrorList() |
31 | 31 |
@@ -15,38 +15,38 @@ |
||
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 | - |
|
30 | - }//end getErrorList() |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * Returns the lines where warnings should occur. |
|
35 | - * |
|
36 | - * The key of the array should represent the line number and the value |
|
37 | - * should represent the number of warnings that should occur on that line. |
|
38 | - * |
|
39 | - * @return array<int, int> |
|
40 | - */ |
|
41 | - public function getWarningList() |
|
42 | - { |
|
43 | - return [ |
|
44 | - 3 => 2, |
|
45 | - 4 => 1, |
|
46 | - 20 => 1, |
|
47 | - ]; |
|
48 | - |
|
49 | - }//end getWarningList() |
|
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 | + |
|
30 | + }//end getErrorList() |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * Returns the lines where warnings should occur. |
|
35 | + * |
|
36 | + * The key of the array should represent the line number and the value |
|
37 | + * should represent the number of warnings that should occur on that line. |
|
38 | + * |
|
39 | + * @return array<int, int> |
|
40 | + */ |
|
41 | + public function getWarningList() |
|
42 | + { |
|
43 | + return [ |
|
44 | + 3 => 2, |
|
45 | + 4 => 1, |
|
46 | + 20 => 1, |
|
47 | + ]; |
|
48 | + |
|
49 | + }//end getWarningList() |
|
50 | 50 | |
51 | 51 | |
52 | 52 | }//end class |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class JumbledIncrementerUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class JumbledIncrementerUnitTest 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 | |
30 | 28 | }//end getErrorList() |
@@ -38,8 +36,7 @@ discard block |
||
38 | 36 | * |
39 | 37 | * @return array<int, int> |
40 | 38 | */ |
41 | - public function getWarningList() |
|
42 | - { |
|
39 | + public function getWarningList() { |
|
43 | 40 | return [ |
44 | 41 | 3 => 2, |
45 | 42 | 4 => 1, |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function getErrorList() |
27 | 27 | { |
28 | - return []; |
|
28 | + return [ ]; |
|
29 | 29 | |
30 | 30 | }//end getErrorList() |
31 | 31 |
@@ -15,48 +15,48 @@ |
||
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 | - 15 => 1, |
|
31 | - 17 => 1, |
|
32 | - 19 => 1, |
|
33 | - 30 => 1, |
|
34 | - 35 => 1, |
|
35 | - 41 => 1, |
|
36 | - 47 => 1, |
|
37 | - 52 => 1, |
|
38 | - 55 => 1, |
|
39 | - 64 => 1, |
|
40 | - 68 => 1, |
|
41 | - 72 => 2, |
|
42 | - ]; |
|
43 | - |
|
44 | - }//end getErrorList() |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * Returns the lines where warnings should occur. |
|
49 | - * |
|
50 | - * The key of the array should represent the line number and the value |
|
51 | - * should represent the number of warnings that should occur on that line. |
|
52 | - * |
|
53 | - * @return array<int, int> |
|
54 | - */ |
|
55 | - public function getWarningList() |
|
56 | - { |
|
57 | - return []; |
|
58 | - |
|
59 | - }//end getWarningList() |
|
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 | + 15 => 1, |
|
31 | + 17 => 1, |
|
32 | + 19 => 1, |
|
33 | + 30 => 1, |
|
34 | + 35 => 1, |
|
35 | + 41 => 1, |
|
36 | + 47 => 1, |
|
37 | + 52 => 1, |
|
38 | + 55 => 1, |
|
39 | + 64 => 1, |
|
40 | + 68 => 1, |
|
41 | + 72 => 2, |
|
42 | + ]; |
|
43 | + |
|
44 | + }//end getErrorList() |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * Returns the lines where warnings should occur. |
|
49 | + * |
|
50 | + * The key of the array should represent the line number and the value |
|
51 | + * should represent the number of warnings that should occur on that line. |
|
52 | + * |
|
53 | + * @return array<int, int> |
|
54 | + */ |
|
55 | + public function getWarningList() |
|
56 | + { |
|
57 | + return []; |
|
58 | + |
|
59 | + }//end getWarningList() |
|
60 | 60 | |
61 | 61 | |
62 | 62 | }//end class |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class EmptyStatementUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class EmptyStatementUnitTest 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 | 15 => 1, |
@@ -52,8 +50,7 @@ discard block |
||
52 | 50 | * |
53 | 51 | * @return array<int, int> |
54 | 52 | */ |
55 | - public function getWarningList() |
|
56 | - { |
|
53 | + public function getWarningList() { |
|
57 | 54 | return []; |
58 | 55 | |
59 | 56 | }//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 |
@@ -60,7 +60,7 @@ |
||
60 | 60 | } else if($a ??= $b) { |
61 | 61 | } elseif( $a = 'abc' && $b = 'def' ) { |
62 | 62 | } elseif( |
63 | - $a = 'abc' |
|
63 | + $a = 'abc' |
|
64 | 64 | && $a .= 'def' |
65 | 65 | ) {} |
66 | 66 |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // OK. |
4 | -if ($a === 123) { |
|
5 | -} elseif ($a == 123) { |
|
6 | -} elseif ($a !== 123) { |
|
7 | -} elseif ($a != 123) {} |
|
4 | +if ( $a === 123 ) { |
|
5 | +} elseif ( $a == 123 ) { |
|
6 | +} elseif ( $a !== 123 ) { |
|
7 | +} elseif ( $a != 123 ) {} |
|
8 | 8 | |
9 | 9 | function abc( $a = 'default' ) {} |
10 | -if (in_array( $a, array( 1 => 'a', 2 => 'b' ) ) ) {} |
|
10 | +if ( in_array( $a, array( 1 => 'a', 2 => 'b' ) ) ) {} |
|
11 | 11 | |
12 | 12 | switch ( $a === $b ) {} |
13 | 13 | switch ( true ) { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | for ( $i = 0; $i == 100; $i++ ) {} |
19 | 19 | for ( $i = 0; $i >= 100; $i++ ) {} |
20 | 20 | for ( $i = 0; ; $i++ ) {} |
21 | -for (;;) {} |
|
21 | +for ( ;; ) {} |
|
22 | 22 | |
23 | 23 | do { |
24 | 24 | } while ( $sample == false ); |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | while ( $sample === false ) {} |
27 | 27 | |
28 | 28 | // Silly, but not an assignment. |
29 | -if (123 = $a) {} |
|
30 | -if (strtolower($b) = $b) {} |
|
31 | -if (array( 1 => 'a', 2 => 'b' ) = $b) {} |
|
29 | +if ( 123 = $a ) {} |
|
30 | +if ( strtolower( $b ) = $b ) {} |
|
31 | +if ( array( 1 => 'a', 2 => 'b' ) = $b ) {} |
|
32 | 32 | |
33 | -if (SOME_CONSTANT = 123) { |
|
34 | -} else if(self::SOME_CONSTANT -= 10) {} |
|
33 | +if ( SOME_CONSTANT = 123 ) { |
|
34 | +} else if ( self::SOME_CONSTANT -= 10 ) {} |
|
35 | 35 | |
36 | 36 | if ( $a() = 123 ) { |
37 | 37 | } else if ( $b->something() = 123 ) { |
@@ -43,34 +43,34 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | // Assignments in condition. |
46 | -if ($a = 123) { |
|
47 | -} elseif ($a = 'abc') { |
|
48 | -} else if( $a += 10 ) { |
|
49 | -} else if($a -= 10) { |
|
50 | -} else if($a *= 10) { |
|
51 | -} else if($a **= 10) { |
|
52 | -} else if($a /= 10) { |
|
53 | -} else if($a .= strtolower($b)) { |
|
54 | -} else if($a %= SOME_CONSTANT) { |
|
55 | -} else if($a &= 2) { |
|
56 | -} else if($a |= 2) { |
|
57 | -} else if($a ^= 2) { |
|
58 | -} else if($a <<= 2) { |
|
59 | -} else if($a >>= 2) { |
|
60 | -} else if($a ??= $b) { |
|
61 | -} elseif( $a = 'abc' && $b = 'def' ) { |
|
62 | -} elseif( |
|
46 | +if ( $a = 123 ) { |
|
47 | +} elseif ( $a = 'abc' ) { |
|
48 | +} else if ( $a += 10 ) { |
|
49 | +} else if ( $a -= 10 ) { |
|
50 | +} else if ( $a *= 10 ) { |
|
51 | +} else if ( $a **= 10 ) { |
|
52 | +} else if ( $a /= 10 ) { |
|
53 | +} else if ( $a .= strtolower( $b ) ) { |
|
54 | +} else if ( $a %= SOME_CONSTANT ) { |
|
55 | +} else if ( $a &= 2 ) { |
|
56 | +} else if ( $a |= 2 ) { |
|
57 | +} else if ( $a ^= 2 ) { |
|
58 | +} else if ( $a <<= 2 ) { |
|
59 | +} else if ( $a >>= 2 ) { |
|
60 | +} else if ( $a ??= $b ) { |
|
61 | +} elseif ( $a = 'abc' && $b = 'def' ) { |
|
62 | +} elseif ( |
|
63 | 63 | $a = 'abc' |
64 | 64 | && $a .= 'def' |
65 | 65 | ) {} |
66 | 66 | |
67 | -if ($a[] = 123) { |
|
68 | -} elseif ($a['something'] = 123) { |
|
69 | -} elseif (self::$a = 123) { |
|
70 | -} elseif (parent::$a *= 123) { |
|
71 | -} elseif (static::$a = 123) { |
|
72 | -} elseif (MyClass::$a .= 'abc') { |
|
73 | -} else if( $this->something += 10 ) {} |
|
67 | +if ( $a[ ] = 123 ) { |
|
68 | +} elseif ( $a[ 'something' ] = 123 ) { |
|
69 | +} elseif ( self::$a = 123 ) { |
|
70 | +} elseif ( parent::$a *= 123 ) { |
|
71 | +} elseif ( static::$a = 123 ) { |
|
72 | +} elseif ( MyClass::$a .= 'abc' ) { |
|
73 | +} else if ( $this->something += 10 ) {} |
|
74 | 74 | |
75 | 75 | switch ( $a = $b ) {} |
76 | 76 | switch ( true ) { |
@@ -89,5 +89,5 @@ discard block |
||
89 | 89 | |
90 | 90 | while ( $sample = false ) {} |
91 | 91 | |
92 | -if ($a = 123) : |
|
92 | +if ( $a = 123 ) : |
|
93 | 93 | endif; |
@@ -15,38 +15,38 @@ |
||
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 | - |
|
30 | - }//end getErrorList() |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * Returns the lines where warnings should occur. |
|
35 | - * |
|
36 | - * The key of the array should represent the line number and the value |
|
37 | - * should represent the number of warnings that should occur on that line. |
|
38 | - * |
|
39 | - * @return array<int, int> |
|
40 | - */ |
|
41 | - public function getWarningList() |
|
42 | - { |
|
43 | - return [ |
|
44 | - 3 => 1, |
|
45 | - 5 => 1, |
|
46 | - 7 => 1, |
|
47 | - ]; |
|
48 | - |
|
49 | - }//end getWarningList() |
|
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 | + |
|
30 | + }//end getErrorList() |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * Returns the lines where warnings should occur. |
|
35 | + * |
|
36 | + * The key of the array should represent the line number and the value |
|
37 | + * should represent the number of warnings that should occur on that line. |
|
38 | + * |
|
39 | + * @return array<int, int> |
|
40 | + */ |
|
41 | + public function getWarningList() |
|
42 | + { |
|
43 | + return [ |
|
44 | + 3 => 1, |
|
45 | + 5 => 1, |
|
46 | + 7 => 1, |
|
47 | + ]; |
|
48 | + |
|
49 | + }//end getWarningList() |
|
50 | 50 | |
51 | 51 | |
52 | 52 | }//end class |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class UnconditionalIfStatementUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class UnconditionalIfStatementUnitTest 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 | |
30 | 28 | }//end getErrorList() |
@@ -38,8 +36,7 @@ discard block |
||
38 | 36 | * |
39 | 37 | * @return array<int, int> |
40 | 38 | */ |
41 | - public function getWarningList() |
|
42 | - { |
|
39 | + public function getWarningList() { |
|
43 | 40 | return [ |
44 | 41 | 3 => 1, |
45 | 42 | 5 => 1, |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function getErrorList() |
27 | 27 | { |
28 | - return []; |
|
28 | + return [ ]; |
|
29 | 29 | |
30 | 30 | }//end getErrorList() |
31 | 31 |
@@ -1,2 +1,1 @@ |
||
1 | 1 | <?php |
2 | -/** Why me? |
|
3 | 2 | \ No newline at end of file |
@@ -1,2 +1,1 @@ |
||
1 | 1 | <?php |
2 | -/** Why me? |
|
3 | 2 | \ No newline at end of file |
@@ -1,2 +1,1 @@ |
||
1 | 1 | <?php |
2 | -/** Why me? |
|
3 | 2 | \ No newline at end of file |
@@ -1,2 +1,1 @@ |
||
1 | 1 | <?php |
2 | -/** Why me? |
|
3 | 2 | \ No newline at end of file |
@@ -1,2 +1,1 @@ |
||
1 | 1 | <?php |
2 | -/** Why me? |
|
3 | 2 | \ No newline at end of file |