@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | for ($i = 0; $i < 10; $i++) { |
3 | - // Everything is fine |
|
3 | + // Everything is fine |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | for (; $it->valid();) { |
7 | - $it->next(); |
|
7 | + $it->next(); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | for (;(($it1->valid() && $foo) || (!$it2->value && ($bar || false)));/*Could be ignored*/) { |
11 | - $it1->next(); |
|
12 | - $it2->next(); |
|
11 | + $it1->next(); |
|
12 | + $it2->next(); |
|
13 | 13 | } |
14 | 14 | \ No newline at end of file |
@@ -1,72 +1,72 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | switch ($foo) { |
4 | - // Empty switch statement body |
|
4 | + // Empty switch statement body |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | switch ($foo) { |
8 | - case 'bar': |
|
9 | - break; |
|
10 | - default: |
|
11 | - break; |
|
8 | + case 'bar': |
|
9 | + break; |
|
10 | + default: |
|
11 | + break; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | |
15 | 15 | if ($foo) { |
16 | - // Just a comment |
|
16 | + // Just a comment |
|
17 | 17 | } elseif ($bar) { |
18 | - // Yet another comment |
|
18 | + // Yet another comment |
|
19 | 19 | } else { |
20 | 20 | |
21 | 21 | } |
22 | 22 | |
23 | 23 | if ($foo) { |
24 | - $foo = 'bar'; |
|
24 | + $foo = 'bar'; |
|
25 | 25 | } else if ($bar) { |
26 | - $bar = 'foo'; |
|
26 | + $bar = 'foo'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | for ($i = 0; $i < 10; $i++) { |
30 | - for ($j = 0; $j < 10; $j++) { |
|
31 | - // Just a comment |
|
32 | - } |
|
30 | + for ($j = 0; $j < 10; $j++) { |
|
31 | + // Just a comment |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | foreach ($foo as $bar) {} |
36 | 36 | |
37 | 37 | foreach ($foo as $bar) { |
38 | - $bar *= 2; |
|
38 | + $bar *= 2; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | do { |
42 | - // Just a comment |
|
43 | - // Just another comment |
|
42 | + // Just a comment |
|
43 | + // Just another comment |
|
44 | 44 | } while ($foo); |
45 | 45 | |
46 | 46 | do { |
47 | - while ($bar) { |
|
47 | + while ($bar) { |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | } while (true); |
51 | 51 | |
52 | 52 | while ($foo) { /* Comment in the same line */ } |
53 | 53 | |
54 | 54 | while ($foo) { |
55 | - try { |
|
55 | + try { |
|
56 | 56 | |
57 | - } catch (Exception $e) { |
|
58 | - echo $e->getTraceAsString(); |
|
59 | - } |
|
57 | + } catch (Exception $e) { |
|
58 | + echo $e->getTraceAsString(); |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | try { |
63 | - throw Exception('Error...'); |
|
63 | + throw Exception('Error...'); |
|
64 | 64 | } catch (Exception $e) {} |
65 | 65 | |
66 | 66 | try { |
67 | - throw Exception('Error...'); |
|
67 | + throw Exception('Error...'); |
|
68 | 68 | } catch (Exception $e) { |
69 | - // TODO: Handle this exception later :-) |
|
69 | + // TODO: Handle this exception later :-) |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | if (true) {} elseif (false) {} |
73 | 73 | \ No newline at end of file |
@@ -1,25 +1,25 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class FooBar { |
4 | - public function __construct($a, $b) { |
|
5 | - parent::__construct($a, $b); |
|
6 | - } |
|
4 | + public function __construct($a, $b) { |
|
5 | + parent::__construct($a, $b); |
|
6 | + } |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | class BarFoo { |
10 | - public function __construct($a, $b) { |
|
11 | - parent::__construct($a, 'XML', $b); |
|
12 | - } |
|
10 | + public function __construct($a, $b) { |
|
11 | + parent::__construct($a, 'XML', $b); |
|
12 | + } |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | class Foo { |
16 | - public function export($a, $b = null) { |
|
17 | - return parent::export($a, $b); |
|
18 | - } |
|
16 | + public function export($a, $b = null) { |
|
17 | + return parent::export($a, $b); |
|
18 | + } |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | class Bar { |
22 | - public function export($a, $b = null) { |
|
23 | - return parent::export($a); |
|
24 | - } |
|
22 | + public function export($a, $b = null) { |
|
23 | + return parent::export($a); |
|
24 | + } |
|
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -1,48 +1,48 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function foo($a, $b) { |
4 | - return $a * 2; |
|
4 | + return $a * 2; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | function baz($a, $b) { |
8 | - echo "baz({$a});"; |
|
8 | + echo "baz({$a});"; |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | function bar($a, $b) { |
12 | - $x = $b; |
|
13 | - for ($i = 0; $i <$a; $i++) { |
|
14 | - $x += $a * $i; |
|
15 | - } |
|
16 | - return $x; |
|
12 | + $x = $b; |
|
13 | + for ($i = 0; $i <$a; $i++) { |
|
14 | + $x += $a * $i; |
|
15 | + } |
|
16 | + return $x; |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | function foobar($a, &$b) { |
20 | - return (preg_match('/foo/', $a, $b) !== 0); |
|
20 | + return (preg_match('/foo/', $a, $b) !== 0); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | class Foo implements Bar { |
24 | - function barfoo($a, $b) { |
|
25 | - // Empty body means interface method in many cases. |
|
26 | - } |
|
24 | + function barfoo($a, $b) { |
|
25 | + // Empty body means interface method in many cases. |
|
26 | + } |
|
27 | 27 | |
28 | - function fooBar($a, $b) { |
|
29 | - return; |
|
30 | - } |
|
28 | + function fooBar($a, $b) { |
|
29 | + return; |
|
30 | + } |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | function foo($bar) |
34 | 34 | { |
35 | - print <<<BAZ |
|
35 | + print <<<BAZ |
|
36 | 36 | $bar |
37 | 37 | BAZ; |
38 | 38 | } |
39 | 39 | |
40 | 40 | function foo( $parameter ) { |
41 | - $wango = <<<HERE |
|
41 | + $wango = <<<HERE |
|
42 | 42 | 1 Must be a HEREdoc of at least one line |
43 | 43 | HERE; |
44 | - $x = $parameter; // This line must be immediately after the HERE; with no intervening blank lines. |
|
45 | - $tango = <<<HERE |
|
44 | + $x = $parameter; // This line must be immediately after the HERE; with no intervening blank lines. |
|
45 | + $tango = <<<HERE |
|
46 | 46 | 1 Must be a HEREdoc |
47 | 47 | 2 |
48 | 48 | 3 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | function foo( $parameter ) { |
59 | - return <<<HTML |
|
59 | + return <<<HTML |
|
60 | 60 | <?xml version="1.0"?> |
61 | 61 | <value>$parameter</value> |
62 | 62 | HTML; |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | |
68 | 68 | function foo($bar) |
69 | 69 | { |
70 | - print "${bar} things\n"; |
|
70 | + print "${bar} things\n"; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | function bar($x) |
74 | 74 | { |
75 | - return 2 * ${x}; |
|
75 | + return 2 * ${x}; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $foo = function ($a, $b) { |
79 | - return $a * 2; |
|
79 | + return $a * 2; |
|
80 | 80 | }; |
81 | 81 | |
82 | 82 | function foobar() { |
83 | - return; |
|
83 | + return; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -91,21 +91,21 @@ discard block |
||
91 | 91 | */ |
92 | 92 | |
93 | 93 | class MyClass { |
94 | - public function something($a, $b) { |
|
95 | - return $a * 2; |
|
96 | - } |
|
94 | + public function something($a, $b) { |
|
95 | + return $a * 2; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | class MyExtendedClass extends SomeClass { |
100 | - public function something($a, $b) { |
|
101 | - return $a * 2; |
|
102 | - } |
|
100 | + public function something($a, $b) { |
|
101 | + return $a * 2; |
|
102 | + } |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | class MyExtendedClass implements SomeInterface { |
106 | - public function something($a, $b) { |
|
107 | - return $a * 2; |
|
108 | - } |
|
106 | + public function something($a, $b) { |
|
107 | + return $a * 2; |
|
108 | + } |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | */ |
116 | 116 | |
117 | 117 | function something($a) { |
118 | - return 'foobar'; |
|
118 | + return 'foobar'; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | function myCallback($a, $b, $c, $d) { |
122 | - return $a * $c; |
|
122 | + return $a * $c; |
|
123 | 123 | } |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |