diff --git a/app/modules/Profiler/Interfaces/Http/Controllers/ShowFlameChartAction.php b/app/modules/Profiler/Interfaces/Http/Controllers/ShowFlameChartAction.php index deeaa2de..917d1a3f 100644 --- a/app/modules/Profiler/Interfaces/Http/Controllers/ShowFlameChartAction.php +++ b/app/modules/Profiler/Interfaces/Http/Controllers/ShowFlameChartAction.php @@ -14,10 +14,10 @@ final readonly class ShowFlameChartAction { #[Route(route: 'profiler//flame-chart', name: 'profiler.show.flame-chart', methods: ['GET'], group: 'api')] - public function __invoke(QueryBusInterface $bus, Uuid $uuid): array + public function __invoke(QueryBusInterface $bus, Uuid $uuid): string { try { - /** @var array $flameChart */ + /** @var string $flameChart */ $flameChart = $bus->ask(new FindFlameChartByUuid($uuid)); } catch (EntityNotFoundException $e) { throw new NotFoundException($e->getMessage()); diff --git a/app/modules/Profiler/Interfaces/Queries/FindFlameChartByUuidHandler.php b/app/modules/Profiler/Interfaces/Queries/FindFlameChartByUuidHandler.php index 5d1bd2ae..f67a6e7a 100644 --- a/app/modules/Profiler/Interfaces/Queries/FindFlameChartByUuidHandler.php +++ b/app/modules/Profiler/Interfaces/Queries/FindFlameChartByUuidHandler.php @@ -20,11 +20,11 @@ public function __construct( ) {} #[QueryHandler] - public function __invoke(FindFlameChartByUuid $query): array + public function __invoke(FindFlameChartByUuid $query): string { $file = $query->profileUuid . '.flamechart.json'; if ($this->bucket->exists($file)) { - return \json_decode($this->bucket->getContents($file), true); + return $this->bucket->getContents($file); } $profile = $this->orm->getRepository(Profile::class)->findByPK($query->profileUuid); @@ -67,9 +67,10 @@ public function __invoke(FindFlameChartByUuid $query): array } $this->adjustStartTimes($waterfall, 0); - $this->bucket->write($file, \json_encode($waterfall, 0, 5000)); + $serialized = \json_encode($waterfall, 0, 5000); + $this->bucket->write($file, $serialized); - return $waterfall; + return $serialized; } private function adjustStartTimes(array &$eventList, float|int $startTime): void