diff --git a/src/Symfony/Bundle/DataCollector/RequestDataCollector.php b/src/Symfony/Bundle/DataCollector/RequestDataCollector.php index ddde1871a0e..02b26ece6dc 100644 --- a/src/Symfony/Bundle/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Bundle/DataCollector/RequestDataCollector.php @@ -73,10 +73,19 @@ public function getVersion(): ?string return null; } - $version = Versions::getVersion('api-platform/core'); + try { + $version = Versions::getVersion('api-platform/symfony'); + } catch (\OutOfBoundsException) { + try { + $version = Versions::getVersion('api-platform/core'); + } catch (\OutOfBoundsException) { + return null; + } + } + preg_match('/^v(.*?)@/', (string) $version, $output); - return $output[1] ?? strtok($version, '@'); + return $output[1] ?? strtok($version, '@') ?: null; } /**