diff --git a/Stopwatch/Stopwatch.php b/Stopwatch/Stopwatch.php index 1f7e3f4..4f1d84b 100644 --- a/Stopwatch/Stopwatch.php +++ b/Stopwatch/Stopwatch.php @@ -74,7 +74,14 @@ private function flushIfTimersLimitReached(): void { $timersCount = count(pinba_timers_get(PINBA_ONLY_STOPPED_TIMERS)); if ($timersCount >= self::FLUSH_TIMERS_LIMIT) { - pinba_flush(null, PINBA_FLUSH_ONLY_STOPPED_TIMERS); + pinba_flush($this->getScriptName(), PINBA_FLUSH_ONLY_STOPPED_TIMERS); } } + + private function getScriptName(): string + { + $pinbaInfo = pinba_get_info(); + + return $pinbaInfo['script_name'] ?? ''; + } } diff --git a/meta/phpstan/stub.php b/meta/phpstan/stub.php index 2f31349..52bdbe8 100644 --- a/meta/phpstan/stub.php +++ b/meta/phpstan/stub.php @@ -33,7 +33,7 @@ function pinba_timers_get(int $flag = 0): array } if (!function_exists('pinba_flush')) { - function pinba_flush(?string $scriptName = null, int $flags = 0): void + function pinba_flush(string $scriptName = '', int $flags = 0): void { } }