Skip to content

Commit ba769e1

Browse files
Merge pull request #81 from TheDragonCode/code-style-3hk0cby
The code style has been fixed
2 parents 1549314 + db7c5c5 commit ba769e1

7 files changed

Lines changed: 15 additions & 12 deletions

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"dragon-code/codestyler": true,
6262
"ergebnis/composer-normalize": true,
6363
"friendsofphp/php-cs-fixer": true,
64+
"laravel/pint": true,
6465
"pestphp/pest-plugin": true,
6566
"symfony/thanks": true
6667
},

src/Benchmark.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function compare(array|Closure ...$callbacks): static
9797
}
9898

9999
/**
100-
* @return \DragonCode\Benchmark\Data\ResultData[]
100+
* @return Data\ResultData[]
101101
*/
102102
public function toData(): array
103103
{
@@ -156,7 +156,7 @@ protected function chunks(array $callbacks, ProgressBarView $progressBar): void
156156

157157
protected function run(mixed $name, Closure $callback, ProgressBarView $progressBar): void
158158
{
159-
for ($i = 1; $i <= $this->iterations; ++$i) {
159+
for ($i = 1; $i <= $this->iterations; $i++) {
160160
$result = $this->callbacks->performBeforeEach($name, $i);
161161

162162
[$time, $memory] = $this->call($callback, [$i, $result]);

src/Services/CallbacksService.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ class CallbacksService
1616

1717
public ?Closure $afterEach = null;
1818

19-
public function performBefore(string|int $name): mixed
19+
public function performBefore(int|string $name): mixed
2020
{
2121
return $this->perform($this->before, $name);
2222
}
2323

24-
public function performBeforeEach(string|int $name, int $iteration): mixed
24+
public function performBeforeEach(int|string $name, int $iteration): mixed
2525
{
2626
return $this->perform($this->beforeEach, $name, $iteration);
2727
}
2828

29-
public function performAfter(string|int $name): mixed
29+
public function performAfter(int|string $name): mixed
3030
{
3131
return $this->perform($this->after, $name);
3232
}
3333

34-
public function performAfterEach(string|int $name, int $iteration, float $time, float $memory): mixed
34+
public function performAfterEach(int|string $name, int $iteration, float $time, float $memory): mixed
3535
{
3636
return $this->perform($this->afterEach, $name, $iteration, $time, $memory);
3737
}

src/Services/CollectorService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class CollectorService
88
{
99
protected array $data = [];
1010

11-
public function push(string|int $name, array $values): static
11+
public function push(int|string $name, array $values): static
1212
{
1313
$this->data[$name][] = $values;
1414

src/Services/ResultService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct(
2323
) {}
2424

2525
/**
26-
* @return \DragonCode\Benchmark\Data\ResultData[]
26+
* @return ResultData[]
2727
*/
2828
public function get(array $collections): array
2929
{
@@ -83,7 +83,7 @@ protected function max(array $times, array $memory): MetricData
8383
protected function avg(array $times, array $memory): MetricData
8484
{
8585
return $this->metric(
86-
time : array_sum($times) / count($times),
86+
time : array_sum($times) / count($times),
8787
memory: array_sum($memory) / count($memory),
8888
);
8989
}

src/Services/RunnerService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ protected function clean(): void
2929
protected function run(Closure $callback, array $parameters = []): array
3030
{
3131
$memoryFrom = $this->memory->now();
32-
$startAt = hrtime(true);
32+
$startAt = hrtime(true);
3333

3434
$callback(...$parameters);
3535

36-
$time = $this->diff(hrtime(true), $startAt);
37-
$memory = $this->memory->diff($memoryFrom);
36+
$time = $this->diff(hrtime(true), $startAt);
37+
$memory = $this->memory->diff($memoryFrom);
3838

3939
return [$time, $memory];
4040
}

tests/Pest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use DragonCode\Benchmark\View\View;
46
use PHPUnit\Framework\TestCase;
57

0 commit comments

Comments
 (0)