@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | switch ($lowerVarType) { |
52 | - case 'bool': |
|
53 | - return 'boolean'; |
|
54 | - echo 'hi'; |
|
55 | - case 'double': |
|
56 | - case 'real': |
|
57 | - return 'float'; |
|
58 | - echo 'hi'; |
|
52 | + case 'bool': |
|
53 | + return 'boolean'; |
|
54 | + echo 'hi'; |
|
55 | + case 'double': |
|
56 | + case 'real': |
|
57 | + return 'float'; |
|
58 | + echo 'hi'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | while ($line=fgets($fp,2*1024*1024)) |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | switch ($var) { |
69 | - case 1: |
|
70 | - echo '1'; |
|
71 | - break; |
|
69 | + case 1: |
|
70 | + echo '1'; |
|
71 | + break; |
|
72 | 72 | |
73 | - echo 'non-executable'; |
|
74 | - default: |
|
75 | - echo '2'; |
|
76 | - break; |
|
73 | + echo 'non-executable'; |
|
74 | + default: |
|
75 | + echo '2'; |
|
76 | + break; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | switch (0) { |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | }//end myFunction() |
125 | 125 | |
126 | 126 | switch ($var) { |
127 | - case 1: { |
|
128 | - return '1'; |
|
129 | - } |
|
127 | + case 1: { |
|
128 | + return '1'; |
|
129 | + } |
|
130 | 130 | |
131 | - case 2: { |
|
132 | - return '2'; |
|
133 | - } |
|
131 | + case 2: { |
|
132 | + return '2'; |
|
133 | + } |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | defined('FOO') or die('error'); |
@@ -202,12 +202,12 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | switch ($foo) { |
205 | - case 'foo': |
|
206 | - if ($foo) |
|
207 | - return $foo; |
|
208 | - return $bar; |
|
209 | - default: |
|
210 | - return $bar; |
|
205 | + case 'foo': |
|
206 | + if ($foo) |
|
207 | + return $foo; |
|
208 | + return $bar; |
|
209 | + default: |
|
210 | + return $bar; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | function foo() |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | switch (true) { |
219 | - case 1: |
|
220 | - return foo( |
|
221 | - function () { |
|
222 | - $foo = $bar; // when this is removed it works ok |
|
223 | - return false; // from here on it reports unreachable |
|
224 | - } |
|
225 | - ); |
|
219 | + case 1: |
|
220 | + return foo( |
|
221 | + function () { |
|
222 | + $foo = $bar; // when this is removed it works ok |
|
223 | + return false; // from here on it reports unreachable |
|
224 | + } |
|
225 | + ); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | exit(); |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | echo 'hi'; |
59 | 59 | } |
60 | 60 | |
61 | -while ($line=fgets($fp,2*1024*1024)) |
|
61 | +while ($line = fgets($fp, 2 * 1024 * 1024)) |
|
62 | 62 | { |
63 | - if (!preg_match("/^<([a-z0-9_]+)/",$line,$matches)) |
|
63 | + if (!preg_match("/^<([a-z0-9_]+)/", $line, $matches)) |
|
64 | 64 | continue; |
65 | 65 | print $line; |
66 | 66 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | }//end myFunction() |
110 | 110 | |
111 | 111 | public static function thisCausesAnError() { |
112 | -return new foo(function() {return $foo;} |
|
112 | +return new foo(function() {return $foo; } |
|
113 | 113 | ); |
114 | 114 | } |
115 | 115 | |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | echo $foo; |
181 | 181 | } |
182 | 182 | |
183 | -function test(){ |
|
184 | - switch($a) { |
|
183 | +function test() { |
|
184 | + switch ($a) { |
|
185 | 185 | case 1: |
186 | 186 | if (empty($b)) |
187 | 187 | return 0; |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | |
213 | 213 | function foo() |
214 | 214 | { |
215 | - return $bar->{$action . 'JsonAction'}(); |
|
215 | + return $bar->{$action.'JsonAction'}(); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | switch (true) { |
219 | 219 | case 1: |
220 | 220 | return foo( |
221 | - function () { |
|
222 | - $foo = $bar; // when this is removed it works ok |
|
221 | + function() { |
|
222 | + $foo = $bar; // when this is removed it works ok |
|
223 | 223 | return false; // from here on it reports unreachable |
224 | 224 | } |
225 | 225 | ); |
@@ -60,8 +60,9 @@ discard block |
||
60 | 60 | |
61 | 61 | while ($line=fgets($fp,2*1024*1024)) |
62 | 62 | { |
63 | - if (!preg_match("/^<([a-z0-9_]+)/",$line,$matches)) |
|
64 | - continue; |
|
63 | + if (!preg_match("/^<([a-z0-9_]+)/",$line,$matches)) { |
|
64 | + continue; |
|
65 | + } |
|
65 | 66 | print $line; |
66 | 67 | } |
67 | 68 | |
@@ -183,19 +184,21 @@ discard block |
||
183 | 184 | function test(){ |
184 | 185 | switch($a) { |
185 | 186 | case 1: |
186 | - if (empty($b)) |
|
187 | - return 0; |
|
187 | + if (empty($b)) { |
|
188 | + return 0; |
|
189 | + } |
|
188 | 190 | break; |
189 | 191 | default: |
190 | 192 | return 2; |
191 | 193 | } |
192 | 194 | |
193 | - if (empty($a)) |
|
194 | - echo '1'; |
|
195 | - elseif ($empty($b)) |
|
196 | - return 0; |
|
197 | - else |
|
198 | - return 1; |
|
195 | + if (empty($a)) { |
|
196 | + echo '1'; |
|
197 | + } elseif ($empty($b)) { |
|
198 | + return 0; |
|
199 | + } else { |
|
200 | + return 1; |
|
201 | + } |
|
199 | 202 | |
200 | 203 | echo "oi"; |
201 | 204 | return 1; |
@@ -203,8 +206,9 @@ discard block |
||
203 | 206 | |
204 | 207 | switch ($foo) { |
205 | 208 | case 'foo': |
206 | - if ($foo) |
|
207 | - return $foo; |
|
209 | + if ($foo) { |
|
210 | + return $foo; |
|
211 | + } |
|
208 | 212 | return $bar; |
209 | 213 | default: |
210 | 214 | return $bar; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -function getVar($varname='var', $var='var') |
|
2 | +function getVar($varname = 'var', $var = 'var') |
|
3 | 3 | { |
4 | 4 | $var = $var2 = getVar(); |
5 | 5 | $var = $var2 = $var3 = ''; |
@@ -38,5 +38,5 @@ discard block |
||
38 | 38 | |
39 | 39 | $obj->$classVar = $prefix.'-'.$type; |
40 | 40 | |
41 | -$closureWithDefaultParamter = function(array $testArray=array()) {}; |
|
41 | +$closureWithDefaultParamter = function(array $testArray = array()) {}; |
|
42 | 42 | ?> |
@@ -58,24 +58,24 @@ |
||
58 | 58 | public function getWarningList($testFile='CommentedOutCodeUnitTest.inc') |
59 | 59 | { |
60 | 60 | switch ($testFile) { |
61 | - case 'CommentedOutCodeUnitTest.inc': |
|
62 | - return array( |
|
63 | - 6 => 1, |
|
64 | - 8 => 1, |
|
65 | - 15 => 1, |
|
66 | - 19 => 1, |
|
67 | - 87 => 1, |
|
68 | - ); |
|
69 | - break; |
|
70 | - case 'CommentedOutCodeUnitTest.css': |
|
71 | - return array( |
|
72 | - 7 => 1, |
|
73 | - 16 => 1, |
|
74 | - ); |
|
75 | - break; |
|
76 | - default: |
|
77 | - return array(); |
|
78 | - break; |
|
61 | + case 'CommentedOutCodeUnitTest.inc': |
|
62 | + return array( |
|
63 | + 6 => 1, |
|
64 | + 8 => 1, |
|
65 | + 15 => 1, |
|
66 | + 19 => 1, |
|
67 | + 87 => 1, |
|
68 | + ); |
|
69 | + break; |
|
70 | + case 'CommentedOutCodeUnitTest.css': |
|
71 | + return array( |
|
72 | + 7 => 1, |
|
73 | + 16 => 1, |
|
74 | + ); |
|
75 | + break; |
|
76 | + default: |
|
77 | + return array(); |
|
78 | + break; |
|
79 | 79 | }//end switch |
80 | 80 | |
81 | 81 | }//end getWarningList() |
@@ -55,7 +55,7 @@ |
||
55 | 55 | * |
56 | 56 | * @return array<int, int> |
57 | 57 | */ |
58 | - public function getWarningList($testFile='CommentedOutCodeUnitTest.inc') |
|
58 | + public function getWarningList($testFile = 'CommentedOutCodeUnitTest.inc') |
|
59 | 59 | { |
60 | 60 | switch ($testFile) { |
61 | 61 | case 'CommentedOutCodeUnitTest.inc': |
@@ -47,13 +47,13 @@ |
||
47 | 47 | return array( |
48 | 48 | 4 => 1, |
49 | 49 | 5 => 1, |
50 | - ); |
|
50 | + ); |
|
51 | 51 | } else if (version_compare(PHP_VERSION, '5.4.0RC1') >= 0) { |
52 | 52 | // Shorthand echo is always available from PHP 5.4.0 but needed the |
53 | 53 | // short_open_tag ini var to be set for versions before this. |
54 | 54 | return array( |
55 | 55 | 4 => 1, |
56 | - ); |
|
56 | + ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return array(); |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * |
41 | 41 | * @return array<int, int> |
42 | 42 | */ |
43 | - public function getErrorList($testFile='DisallowObjectStringIndexUnitTest.js') |
|
43 | + public function getErrorList($testFile = 'DisallowObjectStringIndexUnitTest.js') |
|
44 | 44 | { |
45 | 45 | if ($testFile !== 'DisallowObjectStringIndexUnitTest.js') { |
46 | 46 | return array(); |
@@ -57,7 +57,7 @@ |
||
57 | 57 | 48 => 1, |
58 | 58 | 70 => 1, |
59 | 59 | 71 => 1, |
60 | - ); |
|
60 | + ); |
|
61 | 61 | |
62 | 62 | }//end getErrorList() |
63 | 63 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | $obj = new MyClass(); |
3 | -$obj =& new MyClass(); |
|
3 | +$obj = & new MyClass(); |
|
4 | 4 | $obj = &new MyClass(); |
5 | 5 | new MyClass(); |
6 | 6 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * |
41 | 41 | * @return array<int, int> |
42 | 42 | */ |
43 | - public function getErrorList($testFile='ObjectMemberCommaUnitTest.js') |
|
43 | + public function getErrorList($testFile = 'ObjectMemberCommaUnitTest.js') |
|
44 | 44 | { |
45 | 45 | if ($testFile !== 'ObjectMemberCommaUnitTest.js') { |
46 | 46 | return array(); |
@@ -57,7 +57,7 @@ |
||
57 | 57 | 48 => 1, |
58 | 58 | 70 => 1, |
59 | 59 | 71 => 1, |
60 | - ); |
|
60 | + ); |
|
61 | 61 | |
62 | 62 | }//end getErrorList() |
63 | 63 |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | if ($result['symbol'] !== null && $result['effect'] !== null) { |
60 | 60 | $error = 'A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line %s and the first side effect is on line %s.'; |
61 | 61 | $data = array( |
62 | - $tokens[$result['symbol']]['line'], |
|
63 | - $tokens[$result['effect']]['line'], |
|
64 | - ); |
|
62 | + $tokens[$result['symbol']]['line'], |
|
63 | + $tokens[$result['effect']]['line'], |
|
64 | + ); |
|
65 | 65 | $phpcsFile->addWarning($error, 0, 'FoundWithSymbols', $data); |
66 | 66 | $phpcsFile->recordMetric($stackPtr, 'Declarations and side effects mixed', 'yes'); |
67 | 67 | } else { |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | T_INTERFACE => T_INTERFACE, |
97 | 97 | T_TRAIT => T_TRAIT, |
98 | 98 | T_FUNCTION => T_FUNCTION, |
99 | - ); |
|
99 | + ); |
|
100 | 100 | |
101 | 101 | $conditions = array( |
102 | - T_IF => T_IF, |
|
103 | - T_ELSE => T_ELSE, |
|
104 | - T_ELSEIF => T_ELSEIF, |
|
105 | - ); |
|
102 | + T_IF => T_IF, |
|
103 | + T_ELSE => T_ELSE, |
|
104 | + T_ELSEIF => T_ELSEIF, |
|
105 | + ); |
|
106 | 106 | |
107 | 107 | $firstSymbol = null; |
108 | 108 | $firstEffect = null; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | return array( |
231 | 231 | 'symbol' => $firstSymbol, |
232 | 232 | 'effect' => $firstEffect, |
233 | - ); |
|
233 | + ); |
|
234 | 234 | |
235 | 235 | }//end _searchForConflict() |
236 | 236 |
@@ -60,14 +60,14 @@ |
||
60 | 60 | public function getWarningList($testFile='') |
61 | 61 | { |
62 | 62 | switch ($testFile) { |
63 | - case 'SideEffectsUnitTest.3.inc': |
|
64 | - case 'SideEffectsUnitTest.4.inc': |
|
65 | - case 'SideEffectsUnitTest.5.inc': |
|
66 | - return array( |
|
67 | - 1 => 1, |
|
68 | - ); |
|
69 | - default: |
|
70 | - return array(); |
|
63 | + case 'SideEffectsUnitTest.3.inc': |
|
64 | + case 'SideEffectsUnitTest.4.inc': |
|
65 | + case 'SideEffectsUnitTest.5.inc': |
|
66 | + return array( |
|
67 | + 1 => 1, |
|
68 | + ); |
|
69 | + default: |
|
70 | + return array(); |
|
71 | 71 | }//end switch |
72 | 72 | |
73 | 73 | }//end getWarningList() |
@@ -46,7 +46,7 @@ |
||
46 | 46 | case 'CharacterBeforePHPOpeningTagUnitTest.1.inc': |
47 | 47 | return array( |
48 | 48 | 2 => 1, |
49 | - ); |
|
49 | + ); |
|
50 | 50 | break; |
51 | 51 | default: |
52 | 52 | return array(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return array<int, int> |
42 | 42 | */ |
43 | - public function getErrorList($testFile='') |
|
43 | + public function getErrorList($testFile = '') |
|
44 | 44 | { |
45 | 45 | switch ($testFile) { |
46 | 46 | case 'EndFileNoNewlineUnitTest.1.inc': |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return array<int, int> |
77 | 77 | */ |
78 | - public function getWarningList($testFile='') |
|
78 | + public function getWarningList($testFile = '') |
|
79 | 79 | { |
80 | 80 | return array(); |
81 | 81 |
@@ -7,9 +7,9 @@ |
||
7 | 7 | use Something; |
8 | 8 | use SomethingElse; |
9 | 9 | |
10 | -declare(ticks=1); |
|
10 | +declare(ticks = 1); |
|
11 | 11 | |
12 | -declare(ticks=1) { |
|
12 | +declare(ticks = 1) { |
|
13 | 13 | // Code. |
14 | 14 | } |
15 | 15 |