@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $this->iterations = $this->refineIterations($iterations); |
| 60 | 60 | |
| 61 | - $this->generatorFunction = function (int $iterations, int $i = 1): \Generator { |
|
| 61 | + $this->generatorFunction = function(int $iterations, int $i = 1): \Generator { |
|
| 62 | 62 | while ($i <= $iterations) { |
| 63 | 63 | yield $i++; |
| 64 | 64 | } |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | if ($iterations < self::MIN_ITERATIONS) { |
| 84 | 84 | throw new \RuntimeException( |
| 85 | - __CLASS__ . |
|
| 86 | - ': Number of Iterations should be greater then ' . |
|
| 85 | + __CLASS__. |
|
| 86 | + ': Number of Iterations should be greater then '. |
|
| 87 | 87 | self::MIN_ITERATIONS |
| 88 | 88 | ); |
| 89 | 89 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function check(?int $iterationNumber = null): self |
| 61 | 61 | { |
| 62 | 62 | if ($this->isStopped()) { |
| 63 | - throw new \RuntimeException('Timer[' . $this->name . '] is already stopped.'); |
|
| 63 | + throw new \RuntimeException('Timer['.$this->name.'] is already stopped.'); |
|
| 64 | 64 | } |
| 65 | 65 | if ($this->isNotStarted()) { |
| 66 | 66 | $this->start(); |
@@ -223,10 +223,10 @@ discard block |
||
| 223 | 223 | $stop_ok = true; |
| 224 | 224 | } |
| 225 | 225 | if (!$start_ok) { |
| 226 | - throw new \RuntimeException('Start value is NOT ok. [' . typeOf($start) . ']'); |
|
| 226 | + throw new \RuntimeException('Start value is NOT ok. ['.typeOf($start).']'); |
|
| 227 | 227 | } |
| 228 | 228 | if (!$stop_ok) { |
| 229 | - throw new \RuntimeException('Stop value is NOT ok. [' . typeOf($stop) . ']'); |
|
| 229 | + throw new \RuntimeException('Stop value is NOT ok. ['.typeOf($stop).']'); |
|
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | // There is almost no sense in using polyfill function. |
| 28 | 28 | // If you're REALLY need to use HRTimer set `$ignoreVersionRestrictions` to true. |
| 29 | 29 | // Otherwise use `Timer::class` instance instead. |
| 30 | - throw new \RuntimeException('[' . static::class . '] Your php version is below 7.3.0.'); |
|
| 30 | + throw new \RuntimeException('['.static::class.'] Your php version is below 7.3.0.'); |
|
| 31 | 31 | } |
| 32 | 32 | // @codeCoverageIgnoreStart |
| 33 | 33 | if (PHP_INT_SIZE < INT_SIZE_64BIT) { |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | return $this->full($report); |
| 24 | 24 | } |
| 25 | - throw new \RuntimeException(TimerReport::class . ' expected ' . typeOf($report) . ' given'); |
|
| 25 | + throw new \RuntimeException(TimerReport::class.' expected '.typeOf($report).' given'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | return |
| 36 | 36 | sprintf( |
| 37 | - self::ELAPSED . ': %s %s', |
|
| 37 | + self::ELAPSED.': %s %s', |
|
| 38 | 38 | $this->refineElapsed($report->getElapsed()), |
| 39 | 39 | $eol ? PHP_EOL : '' |
| 40 | 40 | ); |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $r = $report; |
| 70 | 70 | return sprintf( |
| 71 | - self::TIMER . '%s: ' . |
|
| 72 | - self::AVERAGE . ': %s, ' . |
|
| 73 | - self::LAST . ': %s, ' . |
|
| 74 | - self::MIN . '(%s): %s, ' . |
|
| 75 | - self::MAX . '(%s): %s, ' . |
|
| 76 | - self::COUNT . ': %s, ' . |
|
| 77 | - self::ELAPSED . ': %s%s', |
|
| 71 | + self::TIMER.'%s: '. |
|
| 72 | + self::AVERAGE.': %s, '. |
|
| 73 | + self::LAST.': %s, '. |
|
| 74 | + self::MIN.'(%s): %s, '. |
|
| 75 | + self::MAX.'(%s): %s, '. |
|
| 76 | + self::COUNT.': %s, '. |
|
| 77 | + self::ELAPSED.': %s%s', |
|
| 78 | 78 | $this->refineName($r->getName()), |
| 79 | 79 | $this->refineSeconds($r->getAverageValue()), |
| 80 | 80 | $this->refineSeconds($r->getLastValue()), |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | if (DEFAULT_NAME === $name) { |
| 94 | 94 | return ''; |
| 95 | 95 | } |
| 96 | - return '[' . $name . ']'; |
|
| 96 | + return '['.$name.']'; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | protected function refineSeconds(?float $seconds): string |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** @var CounterValuesInterface $report */ |
| 33 | 33 | return |
| 34 | 34 | sprintf( |
| 35 | - self::COUNTER . ': %s%s', |
|
| 35 | + self::COUNTER.': %s%s', |
|
| 36 | 36 | (string)$report->getValue(), |
| 37 | 37 | $eol ? PHP_EOL : '' |
| 38 | 38 | ); |
@@ -47,15 +47,15 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | return |
| 49 | 49 | sprintf( |
| 50 | - self::COUNTER . '[%s]: ' . |
|
| 51 | - self::VALUE . ': %s, ' . |
|
| 52 | - self::STEP . ': %s, ' . |
|
| 53 | - self::BUMPED . ': %s, ' . |
|
| 54 | - self::PATH . ': %s, ' . |
|
| 55 | - self::LENGTH . ': %s, ' . |
|
| 56 | - self::MAX . ': %s, ' . |
|
| 57 | - self::MIN . ': %s, ' . |
|
| 58 | - self::DIFF . ': %s %s', |
|
| 50 | + self::COUNTER.'[%s]: '. |
|
| 51 | + self::VALUE.': %s, '. |
|
| 52 | + self::STEP.': %s, '. |
|
| 53 | + self::BUMPED.': %s, '. |
|
| 54 | + self::PATH.': %s, '. |
|
| 55 | + self::LENGTH.': %s, '. |
|
| 56 | + self::MAX.': %s, '. |
|
| 57 | + self::MIN.': %s, '. |
|
| 58 | + self::DIFF.': %s %s', |
|
| 59 | 59 | $report->getName(), |
| 60 | 60 | (string)$report->getValue(), |
| 61 | 61 | (string)$report->getStep(), |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | return |
| 79 | 79 | sprintf( |
| 80 | - self::FORWARD . '%s ' . self::BACKWARD . '%s', |
|
| 80 | + self::FORWARD.'%s '.self::BACKWARD.'%s', |
|
| 81 | 81 | $report->getBumped(), |
| 82 | 82 | $report->getBumpedBack() |
| 83 | 83 | ); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** @var CounterValuesInterface $report */ |
| 32 | 32 | return |
| 33 | 33 | sprintf( |
| 34 | - self::COUNTER . ': %s%s', |
|
| 34 | + self::COUNTER.': %s%s', |
|
| 35 | 35 | (string)$report->getValue(), |
| 36 | 36 | $eol ? PHP_EOL : '' |
| 37 | 37 | ); |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | return |
| 48 | 48 | sprintf( |
| 49 | - self::COUNTER . '[%s]: ' . |
|
| 50 | - self::VALUE . ': %s, ' . |
|
| 51 | - self::STEP . ': %s, ' . |
|
| 52 | - self::BUMPED . ': %s, ' . |
|
| 49 | + self::COUNTER.'[%s]: '. |
|
| 50 | + self::VALUE.': %s, '. |
|
| 51 | + self::STEP.': %s, '. |
|
| 52 | + self::BUMPED.': %s, '. |
|
| 53 | 53 | $report->getName(), |
| 54 | 54 | (string)$report->getValue(), |
| 55 | 55 | (string)$report->getStep(), |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | return |
| 68 | 68 | sprintf( |
| 69 | - self::FORWARD . '%s ', |
|
| 69 | + self::FORWARD.'%s ', |
|
| 70 | 70 | $report->getBumped() |
| 71 | 71 | ); |
| 72 | 72 | } |
@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | public function process(BenchmarkFunction $function): string |
| 38 | 38 | { |
| 39 | 39 | return |
| 40 | - $this->formatBenchmarkRelative($function) . |
|
| 40 | + $this->formatBenchmarkRelative($function). |
|
| 41 | 41 | (empty($exception = $this->formatException($function)) ? |
| 42 | 42 | PHP_EOL : |
| 43 | - static::EXCEPTIONS . PHP_EOL . $exception); |
|
| 43 | + static::EXCEPTIONS.PHP_EOL.$exception); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -141,12 +141,11 @@ discard block |
||
| 141 | 141 | try { |
| 142 | 142 | $str = var_export($executionReturn, true); |
| 143 | 143 | } catch (\Exception $e) { |
| 144 | - $str = '[' . typeOf($e) . '] ' . $e->getMessage(); |
|
| 144 | + $str = '['.typeOf($e).'] '.$e->getMessage(); |
|
| 145 | 145 | } |
| 146 | 146 | return |
| 147 | 147 | $type === 'array' ? |
| 148 | - $str : |
|
| 149 | - sprintf( |
|
| 148 | + $str : sprintf( |
|
| 150 | 149 | '%s(%s)', |
| 151 | 150 | $type, |
| 152 | 151 | $str |
@@ -23,12 +23,12 @@ |
||
| 23 | 23 | { |
| 24 | 24 | if ($report instanceof BenchmarkReport) { |
| 25 | 25 | $this->report = $report; |
| 26 | - $str = 'Results:' . PHP_EOL; |
|
| 26 | + $str = 'Results:'.PHP_EOL; |
|
| 27 | 27 | $added = $this->added(); |
| 28 | 28 | $benchmarked = $this->benchmarked(); |
| 29 | 29 | $benchmarkedAny = $this->benchmarkedAny($added, $benchmarked); |
| 30 | 30 | if ($benchmarkedAny) { |
| 31 | - $str .= self::BENCHMARK . PHP_EOL; |
|
| 31 | + $str .= self::BENCHMARK.PHP_EOL; |
|
| 32 | 32 | } |
| 33 | 33 | $equalReturns = $this->checkReturns(); |
| 34 | 34 | /** @var BenchmarkFunction $function */ |
@@ -27,6 +27,6 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | protected function wrongReportable(string $expected, ReportableInterface $reportable): void |
| 29 | 29 | { |
| 30 | - throw new \RuntimeException($expected . ' instance expected ' . typeOf($reportable) . ' given'); |
|
| 30 | + throw new \RuntimeException($expected.' instance expected '.typeOf($reportable).' given'); |
|
| 31 | 31 | } |
| 32 | 32 | } |