Skip to content

Commit fa87890

Browse files
committed
change order of time() params
1 parent 23291c7 commit fa87890

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Adapters/Concerns/TimeClosureTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trait TimeClosureTrait
77
/**
88
* @inheritDoc
99
*/
10-
public function time(string $stat, callable $closure, float $sampleRate = 1.0, array $tags = [])
10+
public function time(callable $closure, string $stat, float $sampleRate = 1.0, array $tags = [])
1111
{
1212
$startTime = intval($this->clock->now()->format("Uv"));
1313

src/Adapters/StatsDClientAdapter.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ public function timing(string $stat, float $durationMs, float $sampleRate = 1.0,
1616
/**
1717
* Record a timing stat for the duration of the $closure.
1818
*
19-
* @param string $stat
2019
* @param callable $closure
20+
* @param string $stat
2121
* @param float $sampleRate
2222
* @param array<mixed, mixed> $tags
2323
* @return mixed The return value of $closure
2424
*/
25-
public function time(string $stat, callable $closure, float $sampleRate = 1.0, array $tags = []);
25+
public function time(callable $closure, string $stat, float $sampleRate = 1.0, array $tags = []);
2626

2727
/**
2828
* @param string $stat

tests/Adapters/InMemory/InMemoryTimingTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function time_storesDurationOfClosure(): void
9494
$closure = fn () => "abc";
9595

9696
// When
97-
$actualReturn = $inMemoryClient->time("my-stat", $closure);
97+
$actualReturn = $inMemoryClient->time($closure, "my-stat");
9898

9999
// Then
100100
self::assertEquals("abc", $actualReturn);

0 commit comments

Comments
 (0)