@@ -21,7 +21,7 @@ |
||
| 21 | 21 | /* @codingStandardsIgnoreStart */ |
| 22 | 22 | class MyClass |
| 23 | 23 | { |
| 24 | - /* @codingStandardsIgnoreEnd */ |
|
| 25 | - public function __construct() {} |
|
| 24 | + /* @codingStandardsIgnoreEnd */ |
|
| 25 | + public function __construct() {} |
|
| 26 | 26 | } |
| 27 | 27 | ?> |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | function XMLParser() {} |
| 17 | 17 | function xmlParser() {} |
| 18 | 18 | |
| 19 | -echo preg_replace_callback('~-([a-z])~', function ($match) { return strtoupper($match[1]); }, 'hello-world'); |
|
| 19 | +echo preg_replace_callback('~-([a-z])~', function($match) { return strtoupper($match[1]); }, 'hello-world'); |
|
| 20 | 20 | |
| 21 | 21 | /* @codingStandardsIgnoreStart */ |
| 22 | 22 | class MyClass |
@@ -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 | - 2 => 1, |
|
| 45 | - 4 => 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 | + 2 => 1, |
|
| 45 | + 4 => 1, |
|
| 46 | + ]; |
|
| 47 | + |
|
| 48 | + }//end getWarningList() |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | }//end class |
@@ -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; |
|
| 72 | - |
|
| 73 | - echo 'non-executable'; |
|
| 74 | - default: |
|
| 75 | - echo '2'; |
|
| 76 | - break; |
|
| 69 | + case 1: |
|
| 70 | + echo '1'; |
|
| 71 | + break; |
|
| 72 | + |
|
| 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 | for($i=0,$j=50; $i<100; $i++) { |
@@ -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,110 +1,110 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | switch ($var) { |
| 3 | - case '1': |
|
| 4 | - return; |
|
| 5 | - echo 'hi'; |
|
| 6 | - |
|
| 7 | - case '2': |
|
| 8 | - case '3': |
|
| 9 | - if ($something === true) { |
|
| 10 | - break; |
|
| 11 | - echo 'hi'; |
|
| 12 | - } |
|
| 13 | - break; |
|
| 14 | - default: |
|
| 15 | - return; |
|
| 16 | - |
|
| 17 | - if ($something === true) { |
|
| 18 | - break; |
|
| 19 | - echo 'hi'; |
|
| 20 | - } |
|
| 3 | + case '1': |
|
| 4 | + return; |
|
| 5 | + echo 'hi'; |
|
| 6 | + |
|
| 7 | + case '2': |
|
| 8 | + case '3': |
|
| 9 | + if ($something === true) { |
|
| 10 | + break; |
|
| 11 | + echo 'hi'; |
|
| 12 | + } |
|
| 13 | + break; |
|
| 14 | + default: |
|
| 15 | + return; |
|
| 16 | + |
|
| 17 | + if ($something === true) { |
|
| 18 | + break; |
|
| 19 | + echo 'hi'; |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | function myFunction($var) |
| 25 | 25 | { |
| 26 | - if ($something === TRUE) { |
|
| 27 | - return; |
|
| 28 | - echo 'hi'; |
|
| 29 | - } |
|
| 26 | + if ($something === TRUE) { |
|
| 27 | + return; |
|
| 28 | + echo 'hi'; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - return; |
|
| 32 | - return FALSE; |
|
| 33 | - if ($something === TRUE) { |
|
| 34 | - return TRUE; |
|
| 35 | - } |
|
| 31 | + return; |
|
| 32 | + return FALSE; |
|
| 33 | + if ($something === TRUE) { |
|
| 34 | + return TRUE; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | }//end myFunction() |
| 38 | 38 | |
| 39 | 39 | foreach ($vars as $var) { |
| 40 | - if ($something === TRUE) { |
|
| 41 | - continue; |
|
| 42 | - break; |
|
| 43 | - } else { |
|
| 44 | - continue; |
|
| 45 | - echo 'hi'; |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - echo $var."\n"; |
|
| 40 | + if ($something === TRUE) { |
|
| 41 | + continue; |
|
| 42 | + break; |
|
| 43 | + } else { |
|
| 44 | + continue; |
|
| 45 | + echo 'hi'; |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + echo $var."\n"; |
|
| 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)) |
| 62 | 62 | { |
| 63 | - if (!preg_match("/^<([a-z0-9_]+)/",$line,$matches)) |
|
| 64 | - continue; |
|
| 65 | - print $line; |
|
| 63 | + if (!preg_match("/^<([a-z0-9_]+)/",$line,$matches)) |
|
| 64 | + continue; |
|
| 65 | + print $line; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | switch ($var) { |
| 69 | - case 1: |
|
| 70 | - echo '1'; |
|
| 71 | - break; |
|
| 72 | - |
|
| 73 | - echo 'non-executable'; |
|
| 74 | - default: |
|
| 75 | - echo '2'; |
|
| 76 | - break; |
|
| 69 | + case 1: |
|
| 70 | + echo '1'; |
|
| 71 | + break; |
|
| 72 | + |
|
| 73 | + echo 'non-executable'; |
|
| 74 | + default: |
|
| 75 | + echo '2'; |
|
| 76 | + break; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | switch (0) { |
| 80 | - case 1: |
|
| 81 | - return '1'; |
|
| 80 | + case 1: |
|
| 81 | + return '1'; |
|
| 82 | 82 | |
| 83 | - echo 'non-executable'; |
|
| 84 | - default: |
|
| 85 | - break; |
|
| 83 | + echo 'non-executable'; |
|
| 84 | + default: |
|
| 85 | + break; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | function myFunction() |
| 89 | 89 | { |
| 90 | - if ($something === TRUE) { |
|
| 91 | - return; |
|
| 92 | - } |
|
| 90 | + if ($something === TRUE) { |
|
| 91 | + return; |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - echo 'foo'; |
|
| 95 | - return; |
|
| 94 | + echo 'foo'; |
|
| 95 | + return; |
|
| 96 | 96 | |
| 97 | 97 | }//end myFunction() |
| 98 | 98 | |
| 99 | 99 | function myFunction() |
| 100 | 100 | { |
| 101 | - return uksort( |
|
| 102 | - $array, |
|
| 103 | - function() { |
|
| 104 | - return mt_rand(-1, 1); |
|
| 105 | - echo 'done'; |
|
| 106 | - } |
|
| 107 | - ); |
|
| 101 | + return uksort( |
|
| 102 | + $array, |
|
| 103 | + function() { |
|
| 104 | + return mt_rand(-1, 1); |
|
| 105 | + echo 'done'; |
|
| 106 | + } |
|
| 107 | + ); |
|
| 108 | 108 | |
| 109 | 109 | }//end myFunction() |
| 110 | 110 | |
@@ -115,119 +115,119 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | function myFunction() |
| 117 | 117 | { |
| 118 | - if ($something === TRUE) { |
|
| 119 | - throw new Exception('exception'); |
|
| 120 | - } |
|
| 118 | + if ($something === TRUE) { |
|
| 119 | + throw new Exception('exception'); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - throw new Exception('exception'); |
|
| 123 | - echo 'non-executable'; |
|
| 122 | + throw new Exception('exception'); |
|
| 123 | + echo 'non-executable'; |
|
| 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'); |
| 137 | 137 | defined('FOO') || die('error'); |
| 138 | 138 | interface myInterface { |
| 139 | - function myFunc(); |
|
| 139 | + function myFunc(); |
|
| 140 | 140 | } |
| 141 | 141 | echo 'hello'; |
| 142 | 142 | |
| 143 | 143 | function foo($color) { |
| 144 | - switch ($color) { |
|
| 145 | - case 'red': |
|
| 146 | - return 'yuck'; |
|
| 147 | - break; |
|
| 148 | - case 'blue': |
|
| 149 | - return 'yuck'; |
|
| 150 | - break; |
|
| 151 | - case 'orange': |
|
| 152 | - return 'yay'; |
|
| 153 | - break; |
|
| 154 | - default: |
|
| 155 | - return 'boring'; |
|
| 156 | - } |
|
| 144 | + switch ($color) { |
|
| 145 | + case 'red': |
|
| 146 | + return 'yuck'; |
|
| 147 | + break; |
|
| 148 | + case 'blue': |
|
| 149 | + return 'yuck'; |
|
| 150 | + break; |
|
| 151 | + case 'orange': |
|
| 152 | + return 'yay'; |
|
| 153 | + break; |
|
| 154 | + default: |
|
| 155 | + return 'boring'; |
|
| 156 | + } |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | function returnOverMultipleLines($color) { |
| 160 | - switch ($color) { |
|
| 161 | - case 'red': |
|
| 162 | - return someFunction( |
|
| 163 | - 'multiple', |
|
| 164 | - 'arguments' |
|
| 165 | - ); |
|
| 166 | - echo $foo; |
|
| 167 | - default: |
|
| 168 | - return array( |
|
| 169 | - 'multiline', |
|
| 170 | - 'array' |
|
| 171 | - ); |
|
| 172 | - } |
|
| 160 | + switch ($color) { |
|
| 161 | + case 'red': |
|
| 162 | + return someFunction( |
|
| 163 | + 'multiple', |
|
| 164 | + 'arguments' |
|
| 165 | + ); |
|
| 166 | + echo $foo; |
|
| 167 | + default: |
|
| 168 | + return array( |
|
| 169 | + 'multiline', |
|
| 170 | + 'array' |
|
| 171 | + ); |
|
| 172 | + } |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | function test() { |
| 176 | - return array( |
|
| 177 | - 'multiline', |
|
| 178 | - 'array' |
|
| 179 | - ); |
|
| 180 | - echo $foo; |
|
| 176 | + return array( |
|
| 177 | + 'multiline', |
|
| 178 | + 'array' |
|
| 179 | + ); |
|
| 180 | + echo $foo; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | function test(){ |
| 184 | - switch($a) { |
|
| 185 | - case 1: |
|
| 186 | - if (empty($b)) |
|
| 187 | - return 0; |
|
| 188 | - break; |
|
| 189 | - default: |
|
| 190 | - return 2; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - if (empty($a)) |
|
| 194 | - echo '1'; |
|
| 195 | - elseif ($empty($b)) |
|
| 196 | - return 0; |
|
| 197 | - else |
|
| 198 | - return 1; |
|
| 199 | - |
|
| 200 | - echo "oi"; |
|
| 201 | - return 1; |
|
| 184 | + switch($a) { |
|
| 185 | + case 1: |
|
| 186 | + if (empty($b)) |
|
| 187 | + return 0; |
|
| 188 | + break; |
|
| 189 | + default: |
|
| 190 | + return 2; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + if (empty($a)) |
|
| 194 | + echo '1'; |
|
| 195 | + elseif ($empty($b)) |
|
| 196 | + return 0; |
|
| 197 | + else |
|
| 198 | + return 1; |
|
| 199 | + |
|
| 200 | + echo "oi"; |
|
| 201 | + return 1; |
|
| 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() |
| 214 | 214 | { |
| 215 | - return $bar->{$action . 'JsonAction'}(); |
|
| 215 | + return $bar->{$action . 'JsonAction'}(); |
|
| 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 | for($i=0,$j=50; $i<100; $i++) { |
| 229 | 229 | while($j--) { |
| 230 | - if($j==17) { |
|
| 230 | + if($j==17) { |
|
| 231 | 231 | goto end; |
| 232 | 232 | echo 'unreachable'; |
| 233 | 233 | } |
@@ -235,24 +235,24 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | switch ($var) { |
| 238 | - case '1': |
|
| 239 | - goto end; |
|
| 240 | - echo 'hi'; |
|
| 241 | - |
|
| 242 | - case '2': |
|
| 243 | - case '3': |
|
| 244 | - if ($something === true) { |
|
| 245 | - goto end; |
|
| 246 | - echo 'hi'; |
|
| 247 | - } |
|
| 248 | - break; |
|
| 249 | - default: |
|
| 250 | - goto end; |
|
| 251 | - |
|
| 252 | - if ($something === true) { |
|
| 253 | - goto end; |
|
| 254 | - echo 'hi'; |
|
| 255 | - } |
|
| 238 | + case '1': |
|
| 239 | + goto end; |
|
| 240 | + echo 'hi'; |
|
| 241 | + |
|
| 242 | + case '2': |
|
| 243 | + case '3': |
|
| 244 | + if ($something === true) { |
|
| 245 | + goto end; |
|
| 246 | + echo 'hi'; |
|
| 247 | + } |
|
| 248 | + break; |
|
| 249 | + default: |
|
| 250 | + goto end; |
|
| 251 | + |
|
| 252 | + if ($something === true) { |
|
| 253 | + goto end; |
|
| 254 | + echo 'hi'; |
|
| 255 | + } |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | end: |
@@ -261,37 +261,37 @@ discard block |
||
| 261 | 261 | // Issue 2512. |
| 262 | 262 | class TestAlternativeControlStructures { |
| 263 | 263 | |
| 264 | - public function alternative_switch_in_function( $var ) { |
|
| 265 | - |
|
| 266 | - switch ( $var ) : |
|
| 267 | - case 'value1': |
|
| 268 | - do_something(); |
|
| 269 | - break; |
|
| 270 | - |
|
| 271 | - default: |
|
| 272 | - case 'value2': |
|
| 273 | - do_something_else(); |
|
| 274 | - break; |
|
| 275 | - endswitch; |
|
| 276 | - } |
|
| 277 | - |
|
| 278 | - public function various_alternative_control_structures() { |
|
| 279 | - $_while = 1; |
|
| 280 | - |
|
| 281 | - for ( $a = 0; $a++ < 1; ) : |
|
| 282 | - foreach ( [ 1 ] as $b ) : |
|
| 283 | - while ( $_while-- ) : |
|
| 284 | - if ( 1 ) : |
|
| 285 | - switch ( 1 ) : |
|
| 286 | - default: |
|
| 287 | - echo 'yay, we made it!'; |
|
| 288 | - break; |
|
| 289 | - endswitch; |
|
| 290 | - endif; |
|
| 291 | - endwhile; |
|
| 292 | - endforeach; |
|
| 293 | - endfor; |
|
| 294 | - } |
|
| 264 | + public function alternative_switch_in_function( $var ) { |
|
| 265 | + |
|
| 266 | + switch ( $var ) : |
|
| 267 | + case 'value1': |
|
| 268 | + do_something(); |
|
| 269 | + break; |
|
| 270 | + |
|
| 271 | + default: |
|
| 272 | + case 'value2': |
|
| 273 | + do_something_else(); |
|
| 274 | + break; |
|
| 275 | + endswitch; |
|
| 276 | + } |
|
| 277 | + |
|
| 278 | + public function various_alternative_control_structures() { |
|
| 279 | + $_while = 1; |
|
| 280 | + |
|
| 281 | + for ( $a = 0; $a++ < 1; ) : |
|
| 282 | + foreach ( [ 1 ] as $b ) : |
|
| 283 | + while ( $_while-- ) : |
|
| 284 | + if ( 1 ) : |
|
| 285 | + switch ( 1 ) : |
|
| 286 | + default: |
|
| 287 | + echo 'yay, we made it!'; |
|
| 288 | + break; |
|
| 289 | + endswitch; |
|
| 290 | + endif; |
|
| 291 | + endwhile; |
|
| 292 | + endforeach; |
|
| 293 | + endfor; |
|
| 294 | + } |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | $var_after_class_in_global_space = 1; |
@@ -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,22 +212,22 @@ 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 | ); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | -for($i=0,$j=50; $i<100; $i++) { |
|
| 229 | - while($j--) { |
|
| 230 | - if($j==17) { |
|
| 228 | +for ($i = 0, $j = 50; $i < 100; $i++) { |
|
| 229 | + while ($j--) { |
|
| 230 | + if ($j == 17) { |
|
| 231 | 231 | goto end; |
| 232 | 232 | echo 'unreachable'; |
| 233 | 233 | } |
@@ -261,9 +261,9 @@ discard block |
||
| 261 | 261 | // Issue 2512. |
| 262 | 262 | class TestAlternativeControlStructures { |
| 263 | 263 | |
| 264 | - public function alternative_switch_in_function( $var ) { |
|
| 264 | + public function alternative_switch_in_function($var) { |
|
| 265 | 265 | |
| 266 | - switch ( $var ) : |
|
| 266 | + switch ($var) : |
|
| 267 | 267 | case 'value1': |
| 268 | 268 | do_something(); |
| 269 | 269 | break; |
@@ -278,11 +278,11 @@ discard block |
||
| 278 | 278 | public function various_alternative_control_structures() { |
| 279 | 279 | $_while = 1; |
| 280 | 280 | |
| 281 | - for ( $a = 0; $a++ < 1; ) : |
|
| 282 | - foreach ( [ 1 ] as $b ) : |
|
| 283 | - while ( $_while-- ) : |
|
| 284 | - if ( 1 ) : |
|
| 285 | - switch ( 1 ) : |
|
| 281 | + for ($a = 0; $a++ < 1;) : |
|
| 282 | + foreach ([1] as $b) : |
|
| 283 | + while ($_while--) : |
|
| 284 | + if (1) : |
|
| 285 | + switch (1) : |
|
| 286 | 286 | default: |
| 287 | 287 | echo 'yay, we made it!'; |
| 288 | 288 | break; |
@@ -15,39 +15,39 @@ |
||
| 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 | - 8 => 1, |
|
| 31 | - 13 => 1, |
|
| 32 | - 15 => 1, |
|
| 33 | - ]; |
|
| 34 | - |
|
| 35 | - }//end getErrorList() |
|
| 36 | - |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Returns the lines where warnings should occur. |
|
| 40 | - * |
|
| 41 | - * The key of the array should represent the line number and the value |
|
| 42 | - * should represent the number of warnings that should occur on that line. |
|
| 43 | - * |
|
| 44 | - * @return array<int, int> |
|
| 45 | - */ |
|
| 46 | - public function getWarningList() |
|
| 47 | - { |
|
| 48 | - return []; |
|
| 49 | - |
|
| 50 | - }//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 | + 8 => 1, |
|
| 31 | + 13 => 1, |
|
| 32 | + 15 => 1, |
|
| 33 | + ]; |
|
| 34 | + |
|
| 35 | + }//end getErrorList() |
|
| 36 | + |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Returns the lines where warnings should occur. |
|
| 40 | + * |
|
| 41 | + * The key of the array should represent the line number and the value |
|
| 42 | + * should represent the number of warnings that should occur on that line. |
|
| 43 | + * |
|
| 44 | + * @return array<int, int> |
|
| 45 | + */ |
|
| 46 | + public function getWarningList() |
|
| 47 | + { |
|
| 48 | + return []; |
|
| 49 | + |
|
| 50 | + }//end getWarningList() |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | }//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 | - 2 => 1, |
|
| 45 | - 3 => 1, |
|
| 46 | - 4 => 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 | + 2 => 1, |
|
| 45 | + 3 => 1, |
|
| 46 | + 4 => 1, |
|
| 47 | + ]; |
|
| 48 | + |
|
| 49 | + }//end getWarningList() |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | }//end class |
@@ -5,9 +5,9 @@ |
||
| 5 | 5 | |
| 6 | 6 | function func1() |
| 7 | 7 | { |
| 8 | - global $var; |
|
| 9 | - global $var, $var2; |
|
| 10 | - echo $var; |
|
| 11 | - echo $GLOBALS['var']; |
|
| 8 | + global $var; |
|
| 9 | + global $var, $var2; |
|
| 10 | + echo $var; |
|
| 11 | + echo $GLOBALS['var']; |
|
| 12 | 12 | } |
| 13 | 13 | ?> |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if (Function_Exists('myFunction') === TRUE) { |
| 3 | - $retval = MyFunction(true); |
|
| 4 | - $keys = Array_Keys($array); |
|
| 3 | + $retval = MyFunction(true); |
|
| 4 | + $keys = Array_Keys($array); |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | function getType() {} |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | $count = $object->count(); |
| 14 | 14 | $count = $object::count(); |
| 15 | 15 | class MyClass { |
| 16 | - public function Count() {} |
|
| 16 | + public function Count() {} |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | function &Sort() { |
@@ -2,12 +2,12 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | trySomething() || trySomethingElse(); |
| 4 | 4 | if (trySomething() === FALSE) { |
| 5 | - trySomethingElse(); |
|
| 5 | + trySomethingElse(); |
|
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | $success || fail(); |
| 9 | 9 | if ($success === FALSE) { |
| 10 | - fail(); |
|
| 10 | + fail(); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | $foo = ($bar || $foo); |
@@ -15,13 +15,13 @@ discard block |
||
| 15 | 15 | doSomething() || die(); |
| 16 | 16 | |
| 17 | 17 | if ($something || somethingElse()) { |
| 18 | - while ($foo && $bar) { |
|
| 19 | - } |
|
| 18 | + while ($foo && $bar) { |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - do { |
|
| 22 | - // Code here. |
|
| 23 | - } |
|
| 24 | - while ($foo && $bar); |
|
| 21 | + do { |
|
| 22 | + // Code here. |
|
| 23 | + } |
|
| 24 | + while ($foo && $bar); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | ?> |
| 28 | 28 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - // Not embedded. Do not check here. |
|
| 3 | - echo 'hello'; |
|
| 2 | + // Not embedded. Do not check here. |
|
| 3 | + echo 'hello'; |
|
| 4 | 4 | ?> |
| 5 | 5 | <html> |
| 6 | 6 | <head> |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | </head> |
| 10 | 10 | <body> |
| 11 | 11 | <?php |
| 12 | - echo $body; |
|
| 13 | - ?> |
|
| 12 | + echo $body; |
|
| 13 | + ?> |
|
| 14 | 14 | hello |
| 15 | 15 | <?php |
| 16 | - echo $moreBody; |
|
| 17 | - ?> |
|
| 16 | + echo $moreBody; |
|
| 17 | + ?> |
|
| 18 | 18 | <?php echo 'hi'; ?> |
| 19 | 19 | <?php echo 'hi'; ?> |
| 20 | 20 | <?php echo 'hi;' ?> |
@@ -22,68 +22,68 @@ discard block |
||
| 22 | 22 | <?php echo 'hi'; echo 'hi;'; ?> |
| 23 | 23 | |
| 24 | 24 | <?php |
| 25 | - ?> |
|
| 25 | + ?> |
|
| 26 | 26 | <?php ?> |
| 27 | 27 | |
| 28 | 28 | <?php |
| 29 | 29 | |
| 30 | - echo $moreBody; |
|
| 30 | + echo $moreBody; |
|
| 31 | 31 | |
| 32 | - ?> |
|
| 32 | + ?> |
|
| 33 | 33 | <?php |
| 34 | 34 | |
| 35 | - echo $moreBody; |
|
| 35 | + echo $moreBody; |
|
| 36 | 36 | |
| 37 | - ?> |
|
| 37 | + ?> |
|
| 38 | 38 | |
| 39 | 39 | <?php |
| 40 | - echo $moreBody; ?> |
|
| 40 | + echo $moreBody; ?> |
|
| 41 | 41 | <?php echo $moreBody; |
| 42 | - ?> |
|
| 42 | + ?> |
|
| 43 | 43 | |
| 44 | 44 | <?php |
| 45 | - echo 'hi'; |
|
| 46 | - ?> |
|
| 45 | + echo 'hi'; |
|
| 46 | + ?> |
|
| 47 | 47 | |
| 48 | 48 | <?php |
| 49 | 49 | echo 'hi'; |
| 50 | - ?> |
|
| 50 | + ?> |
|
| 51 | 51 | </body> |
| 52 | 52 | </html> |
| 53 | 53 | <?php |
| 54 | 54 | function test() |
| 55 | 55 | { |
| 56 | - foreach ($root->section as $section) { |
|
| 57 | - ?> |
|
| 56 | + foreach ($root->section as $section) { |
|
| 57 | + ?> |
|
| 58 | 58 | <table> |
| 59 | 59 | <?php if ($foo) { |
| 60 | - ?> |
|
| 60 | + ?> |
|
| 61 | 61 | <tr> |
| 62 | 62 | </tr> |
| 63 | 63 | <?php } |
| 64 | - ?> |
|
| 64 | + ?> |
|
| 65 | 65 | <?php |
| 66 | - foreach ($bar as $bar) { |
|
| 67 | - echo $bar; |
|
| 68 | - } |
|
| 69 | - } |
|
| 66 | + foreach ($bar as $bar) { |
|
| 67 | + echo $bar; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - foreach ($root->section as $section) { |
|
| 72 | - ?> |
|
| 71 | + foreach ($root->section as $section) { |
|
| 72 | + ?> |
|
| 73 | 73 | <table> |
| 74 | 74 | <?php |
| 75 | - if ($foo) { |
|
| 76 | - ?> |
|
| 75 | + if ($foo) { |
|
| 76 | + ?> |
|
| 77 | 77 | <tr> |
| 78 | 78 | </tr> |
| 79 | 79 | <?php |
| 80 | 80 | } |
| 81 | - ?> |
|
| 81 | + ?> |
|
| 82 | 82 | <?php |
| 83 | - foreach ($bar as $bar) { |
|
| 84 | - echo $bar; |
|
| 85 | - } |
|
| 86 | - } |
|
| 83 | + foreach ($bar as $bar) { |
|
| 84 | + echo $bar; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | echo 'goodbye'; |
@@ -91,15 +91,15 @@ discard block |
||
| 91 | 91 | function foo() |
| 92 | 92 | { |
| 93 | 93 | |
| 94 | - ?><a onClick="Javascript: set_hidden_field('<?php echo $link_offset - $num_per_page; ?>'); set_hidden_field('process_form', '0'); submit_form(); return false;"><?php |
|
| 94 | + ?><a onClick="Javascript: set_hidden_field('<?php echo $link_offset - $num_per_page; ?>'); set_hidden_field('process_form', '0'); submit_form(); return false;"><?php |
|
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | ?> |
| 99 | 99 | |
| 100 | 100 | <strong><?php |
| 101 | - echo 'foo'; |
|
| 102 | - ?></strong> |
|
| 101 | + echo 'foo'; |
|
| 102 | + ?></strong> |
|
| 103 | 103 | |
| 104 | 104 | ?> |
| 105 | 105 | |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | echo $moreBody; |
| 17 | 17 | ?> |
| 18 | 18 | <?php echo 'hi'; ?> |
| 19 | - <?php echo 'hi'; ?> |
|
| 19 | + <?php echo 'hi'; ?> |
|
| 20 | 20 | <?php echo 'hi;' ?> |
| 21 | 21 | <?php echo 'hi'; echo 'hi;'; ?> |
| 22 | - <?php echo 'hi'; echo 'hi;'; ?> |
|
| 22 | + <?php echo 'hi'; echo 'hi;'; ?> |
|
| 23 | 23 | |
| 24 | 24 | <?php |
| 25 | 25 | ?> |