Skip to content

Commit d8dcab9

Browse files
Merge pull request #88 from roxblnfk/add-types
Add type hints in Benchmark methods
2 parents 91a1768 + 0647f9f commit d8dcab9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Benchmark.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,41 +41,59 @@ public static function make(): static
4141
return new static;
4242
}
4343

44+
/**
45+
* @param Closure(int|string $name): mixed $callback
46+
*/
4447
public function before(Closure $callback): static
4548
{
4649
$this->callbacks->before = $callback;
4750

4851
return $this;
4952
}
5053

54+
/**
55+
* @param Closure(int|string $name, int<1, max> $iteration): mixed $callback
56+
*/
5157
public function beforeEach(Closure $callback): static
5258
{
5359
$this->callbacks->beforeEach = $callback;
5460

5561
return $this;
5662
}
5763

64+
/**
65+
* @param Closure(int|string $name): mixed $callback
66+
*/
5867
public function after(Closure $callback): static
5968
{
6069
$this->callbacks->after = $callback;
6170

6271
return $this;
6372
}
6473

74+
/**
75+
* @param Closure(int|string $name, int<1, max> $iteration, float $time, float $memory): mixed $callback
76+
*/
6577
public function afterEach(Closure $callback): static
6678
{
6779
$this->callbacks->afterEach = $callback;
6880

6981
return $this;
7082
}
7183

84+
/**
85+
* @param int<1, max> $count
86+
*/
7287
public function iterations(int $count): static
7388
{
7489
$this->iterations = max(1, abs($count));
7590

7691
return $this;
7792
}
7893

94+
/**
95+
* @param int<0, max>|null $precision
96+
*/
7997
public function round(?int $precision): static
8098
{
8199
$this->transformer->round($precision);

0 commit comments

Comments
 (0)