@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | { |
| 256 | 256 | if ($this->numTests == -1) { |
| 257 | 257 | $this->numTests = \count($suite); |
| 258 | - $this->numTestsWidth = \strlen((string) $this->numTests); |
|
| 259 | - $this->maxColumn = $this->numberOfColumns - \strlen(' / (XXX%)') - (2 * $this->numTestsWidth); |
|
| 258 | + $this->numTestsWidth = \strlen((string)$this->numTests); |
|
| 259 | + $this->maxColumn = $this->numberOfColumns - \strlen(' / (XXX%)') - (2*$this->numTestsWidth); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | protected function printDefectTrace(TestFailure $defect): void |
| 369 | 369 | { |
| 370 | 370 | $e = $defect->thrownException(); |
| 371 | - $this->write((string) $e); |
|
| 371 | + $this->write((string)$e); |
|
| 372 | 372 | |
| 373 | 373 | while ($e = $e->getPrevious()) { |
| 374 | 374 | $this->write("\nCaused by\n" . $e); |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | $this->numTestsWidth . 'd (%3s%%)', |
| 508 | 508 | $this->numTestsRun, |
| 509 | 509 | $this->numTests, |
| 510 | - \floor(($this->numTestsRun / $this->numTests) * 100) |
|
| 510 | + \floor(($this->numTestsRun/$this->numTests)*100) |
|
| 511 | 511 | ) |
| 512 | 512 | ); |
| 513 | 513 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | case '--columns': |
| 314 | 314 | if (\is_numeric($option[1])) { |
| 315 | - $this->arguments['columns'] = (int) $option[1]; |
|
| 315 | + $this->arguments['columns'] = (int)$option[1]; |
|
| 316 | 316 | } elseif ($option[1] === 'max') { |
| 317 | 317 | $this->arguments['columns'] = 'max'; |
| 318 | 318 | } |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | break; |
| 518 | 518 | |
| 519 | 519 | case '--repeat': |
| 520 | - $this->arguments['repeat'] = (int) $option[1]; |
|
| 520 | + $this->arguments['repeat'] = (int)$option[1]; |
|
| 521 | 521 | |
| 522 | 522 | break; |
| 523 | 523 | |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | break; |
| 695 | 695 | |
| 696 | 696 | case '--default-time-limit': |
| 697 | - $this->arguments['defaultTimeLimit'] = (int) $option[1]; |
|
| 697 | + $this->arguments['defaultTimeLimit'] = (int)$option[1]; |
|
| 698 | 698 | |
| 699 | 699 | break; |
| 700 | 700 | |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | break; |
| 730 | 730 | |
| 731 | 731 | case '--random-order-seed': |
| 732 | - $this->arguments['randomOrderSeed'] = (int) $option[1]; |
|
| 732 | + $this->arguments['randomOrderSeed'] = (int)$option[1]; |
|
| 733 | 733 | |
| 734 | 734 | break; |
| 735 | 735 | |
@@ -67,8 +67,8 @@ |
||
| 67 | 67 | // But EMPTY objects MUST remain empty objects. (Otherwise we will |
| 68 | 68 | // re-encode it as a JSON array rather than a JSON object.) |
| 69 | 69 | // See #2919. |
| 70 | - if (\is_object($json) && \count((array) $json) > 0) { |
|
| 71 | - $json = (array) $json; |
|
| 70 | + if (\is_object($json) && \count((array)$json) > 0) { |
|
| 71 | + $json = (array)$json; |
|
| 72 | 72 | } else { |
| 73 | 73 | return; |
| 74 | 74 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public static function handleErrorOnce($severity = \E_WARNING): callable |
| 83 | 83 | { |
| 84 | - $terminator = function () { |
|
| 84 | + $terminator = function() { |
|
| 85 | 85 | static $expired = false; |
| 86 | 86 | |
| 87 | 87 | if (!$expired) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | 94 | \set_error_handler( |
| 95 | - function ($errorNumber, $errorString) use ($severity) { |
|
| 95 | + function($errorNumber, $errorString) use ($severity) { |
|
| 96 | 96 | if ($errorNumber === $severity) { |
| 97 | 97 | return; |
| 98 | 98 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $time |
| 239 | 239 | ); |
| 240 | 240 | } else { |
| 241 | - \set_error_handler(function ($errno, $errstr, $errfile, $errline): void { |
|
| 241 | + \set_error_handler(function($errno, $errstr, $errfile, $errline): void { |
|
| 242 | 242 | throw new ErrorException($errstr, $errno, $errno, $errfile, $errline); |
| 243 | 243 | }); |
| 244 | 244 | |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | if ($exception instanceof __PHP_Incomplete_Class) { |
| 355 | 355 | $exceptionArray = []; |
| 356 | 356 | |
| 357 | - foreach ((array) $exception as $key => $value) { |
|
| 357 | + foreach ((array)$exception as $key => $value) { |
|
| 358 | 358 | $key = \substr($key, \strrpos($key, "\0") + 1); |
| 359 | 359 | $exceptionArray[$key] = $value; |
| 360 | 360 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | $groups = \array_filter( |
| 154 | 154 | $test->getGroups(), |
| 155 | - function ($group) { |
|
| 155 | + function($group) { |
|
| 156 | 156 | return !($group === 'small' || $group === 'medium' || $group === 'large'); |
| 157 | 157 | } |
| 158 | 158 | ); |
@@ -172,11 +172,11 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | if (isset($inlineAnnotations['given'], $inlineAnnotations['when'], $inlineAnnotations['then'])) { |
| 174 | 174 | $node->setAttribute('given', $inlineAnnotations['given']['value']); |
| 175 | - $node->setAttribute('givenStartLine', (string) $inlineAnnotations['given']['line']); |
|
| 175 | + $node->setAttribute('givenStartLine', (string)$inlineAnnotations['given']['line']); |
|
| 176 | 176 | $node->setAttribute('when', $inlineAnnotations['when']['value']); |
| 177 | - $node->setAttribute('whenStartLine', (string) $inlineAnnotations['when']['line']); |
|
| 177 | + $node->setAttribute('whenStartLine', (string)$inlineAnnotations['when']['line']); |
|
| 178 | 178 | $node->setAttribute('then', $inlineAnnotations['then']['value']); |
| 179 | - $node->setAttribute('thenStartLine', (string) $inlineAnnotations['then']['line']); |
|
| 179 | + $node->setAttribute('thenStartLine', (string)$inlineAnnotations['then']['line']); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | if ($this->exception !== null) { |
@@ -110,14 +110,14 @@ discard block |
||
| 110 | 110 | private function getFormattedRuntime(): string |
| 111 | 111 | { |
| 112 | 112 | if ($this->runtime > 5) { |
| 113 | - return ($this->colorize)('fg-red', \sprintf('[%.2f ms]', $this->runtime * 1000)); |
|
| 113 | + return ($this->colorize)('fg-red', \sprintf('[%.2f ms]', $this->runtime*1000)); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | if ($this->runtime > 1) { |
| 117 | - return ($this->colorize)('fg-yellow', \sprintf('[%.2f ms]', $this->runtime * 1000)); |
|
| 117 | + return ($this->colorize)('fg-yellow', \sprintf('[%.2f ms]', $this->runtime*1000)); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - return \sprintf('[%.2f ms]', $this->runtime * 1000); |
|
| 120 | + return \sprintf('[%.2f ms]', $this->runtime*1000); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | private function getFormattedAdditionalInformation($verbose): string |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | \implode( |
| 132 | 132 | "\n", |
| 133 | 133 | \array_map( |
| 134 | - function (string $text) { |
|
| 134 | + function(string $text) { |
|
| 135 | 135 | return \sprintf(' │ %s', $text); |
| 136 | 136 | }, |
| 137 | 137 | \explode("\n", $this->additionalInformation) |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $result = $className; |
| 40 | 40 | |
| 41 | - if (\substr($className, -1 * \strlen('Test')) === 'Test') { |
|
| 41 | + if (\substr($className, -1*\strlen('Test')) === 'Test') { |
|
| 42 | 42 | $result = \substr($result, 0, \strripos($result, 'Test')); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $annotations = $test->getAnnotations(); |
| 64 | 64 | $annotationWithPlaceholders = false; |
| 65 | 65 | |
| 66 | - $callback = static function (string $variable): string { |
|
| 66 | + $callback = static function(string $variable): string { |
|
| 67 | 67 | return \sprintf('/%s(?=\b)/', \preg_quote($variable, '/')); |
| 68 | 68 | }; |
| 69 | 69 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $reflector = new \ReflectionObject($value); |
| 172 | 172 | |
| 173 | 173 | if ($reflector->hasMethod('__toString')) { |
| 174 | - $value = (string) $value; |
|
| 174 | + $value = (string)$value; |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $this->lastTestFailed = true; |
| 171 | 171 | $this->testResultMessage = $this->formatTestResultMessage( |
| 172 | 172 | $this->formatWithColor('fg-yellow', '✘'), |
| 173 | - (string) $t, |
|
| 173 | + (string)$t, |
|
| 174 | 174 | $time, |
| 175 | 175 | true |
| 176 | 176 | ); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $this->lastTestFailed = true; |
| 182 | 182 | $this->testResultMessage = $this->formatTestResultMessage( |
| 183 | 183 | $this->formatWithColor('fg-yellow', '✘'), |
| 184 | - (string) $e, |
|
| 184 | + (string)$e, |
|
| 185 | 185 | $time, |
| 186 | 186 | true |
| 187 | 187 | ); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $this->lastTestFailed = true; |
| 193 | 193 | $this->testResultMessage = $this->formatTestResultMessage( |
| 194 | 194 | $this->formatWithColor('fg-red', '✘'), |
| 195 | - (string) $e, |
|
| 195 | + (string)$e, |
|
| 196 | 196 | $time, |
| 197 | 197 | true |
| 198 | 198 | ); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $this->lastTestFailed = true; |
| 204 | 204 | $this->testResultMessage = $this->formatTestResultMessage( |
| 205 | 205 | $this->formatWithColor('fg-yellow', '∅'), |
| 206 | - (string) $t, |
|
| 206 | + (string)$t, |
|
| 207 | 207 | $time, |
| 208 | 208 | false |
| 209 | 209 | ); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $this->lastTestFailed = true; |
| 215 | 215 | $this->testResultMessage = $this->formatTestResultMessage( |
| 216 | 216 | $this->formatWithColor('fg-yellow', '☢'), |
| 217 | - (string) $t, |
|
| 217 | + (string)$t, |
|
| 218 | 218 | $time, |
| 219 | 219 | false |
| 220 | 220 | ); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $this->lastTestFailed = true; |
| 226 | 226 | $this->testResultMessage = $this->formatTestResultMessage( |
| 227 | 227 | $this->formatWithColor('fg-yellow', '→'), |
| 228 | - (string) $t, |
|
| 228 | + (string)$t, |
|
| 229 | 229 | $time, |
| 230 | 230 | false |
| 231 | 231 | ); |
@@ -361,14 +361,14 @@ discard block |
||
| 361 | 361 | private function getFormattedRuntime(float $time): string |
| 362 | 362 | { |
| 363 | 363 | if ($time > 5) { |
| 364 | - return $this->formatWithColor('fg-red', \sprintf('[%.2f ms]', $time * 1000)); |
|
| 364 | + return $this->formatWithColor('fg-red', \sprintf('[%.2f ms]', $time*1000)); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | if ($time > 1) { |
| 368 | - return $this->formatWithColor('fg-yellow', \sprintf('[%.2f ms]', $time * 1000)); |
|
| 368 | + return $this->formatWithColor('fg-yellow', \sprintf('[%.2f ms]', $time*1000)); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - return \sprintf('[%.2f ms]', $time * 1000); |
|
| 371 | + return \sprintf('[%.2f ms]', $time*1000); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | private function getFormattedAdditionalInformation(string $resultMessage, bool $verbose): string |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | \implode( |
| 387 | 387 | "\n", |
| 388 | 388 | \array_map( |
| 389 | - function (string $text) { |
|
| 389 | + function(string $text) { |
|
| 390 | 390 | return \sprintf(' │ %s', $text); |
| 391 | 391 | }, |
| 392 | 392 | \explode("\n", $resultMessage) |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | return; |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - if ((\count($this->nonSuccessfulTestResults) / $numberOfExecutedTests) >= 0.7) { |
|
| 404 | + if ((\count($this->nonSuccessfulTestResults)/$numberOfExecutedTests) >= 0.7) { |
|
| 405 | 405 | return; |
| 406 | 406 | } |
| 407 | 407 | |