Skip to content

Commit da850c5

Browse files
Merge pull request #43
[4.x] Rename `start` method to `make`
2 parents 59a9e4f + ea176b5 commit da850c5

4 files changed

Lines changed: 13 additions & 11 deletions

File tree

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ Or manually update `require-dev` block of `composer.json` and run `composer upda
3838
```php
3939
use DragonCode\Benchmark\Benchmark;
4040

41-
Benchmark::start()->compare(
41+
Benchmark::make()->compare(
4242
fn () => /* some code */,
4343
fn () => /* some code */,
4444
);
4545

46-
Benchmark::start()->compare([
46+
Benchmark::make()->compare([
4747
fn () => /* some code */,
4848
fn () => /* some code */,
4949
]);
5050

51-
Benchmark::start()->compare([
51+
Benchmark::make()->compare([
5252
'foo' => fn () => /* some code */,
5353
'bar' => fn () => /* some code */,
5454
]);
@@ -94,7 +94,7 @@ the `iterations` method:
9494
```php
9595
use DragonCode\Benchmark\Benchmark;
9696

97-
Benchmark::start()
97+
Benchmark::make()
9898
->iterations(5)
9999
->compare(
100100
fn () => /* some code */,
@@ -128,7 +128,7 @@ You can also get the number of the current execution iteration from the input pa
128128
```php
129129
use DragonCode\Benchmark\Benchmark;
130130

131-
Benchmark::start()
131+
Benchmark::make()
132132
->iterations(5)
133133
->compare(
134134
fn (int $iteration) => /* some code */,
@@ -146,7 +146,7 @@ For example:
146146
```php
147147
use DragonCode\Benchmark\Benchmark;
148148

149-
Benchmark::start()
149+
Benchmark::make()
150150
->iterations(5)
151151
->round(2)
152152
->compare(
@@ -185,7 +185,7 @@ There is a `prepare` method for this:
185185
```php
186186
use DragonCode\Benchmark\Benchmark;
187187

188-
Benchmark::start()
188+
Benchmark::make()
189189
->prepare(fn () => /* some code */)
190190
->compare(
191191
fn () => /* some code */,
@@ -199,7 +199,7 @@ inside the callback function.
199199
```php
200200
use DragonCode\Benchmark\Benchmark;
201201

202-
Benchmark::start()
202+
Benchmark::make()
203203
->prepare(fn (mixed $name, int $iteration) => /* some code */)
204204
->compare(
205205
fn () => /* some code */,
@@ -213,7 +213,7 @@ the input parameter:
213213
```php
214214
use DragonCode\Benchmark\Benchmark;
215215

216-
Benchmark::start()
216+
Benchmark::make()
217217
->prepare(fn (mixed $name, int $iteration) => /* some code */)
218218
->compare(
219219
fn (int $iteration, mixed $prepareResult) => /* some code */,

UPGRADING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44

55
- Удалён метод `withoutData`
66
- Метод `prepare` переименован в `beforeEach`
7+
- Исправлена типизация входящих колбэков с супер-класса `callable` на `Closure`
8+
- Метод `start` переименован в `make`

src/Benchmark.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(
4848
);
4949
}
5050

51-
public static function start(): static
51+
public static function make(): static
5252
{
5353
return new static;
5454
}

tests/Benchmark/CreateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ public function testAsDynamic(): void
1616

1717
public function testAsStatic(): void
1818
{
19-
$this->assertInstanceOf(Benchmark::class, Benchmark::start());
19+
$this->assertInstanceOf(Benchmark::class, Benchmark::make());
2020
}
2121
}

0 commit comments

Comments
 (0)