diff --git a/src/DataProvider.php b/src/DataProvider.php index 6ce93c2..9bc8309 100644 --- a/src/DataProvider.php +++ b/src/DataProvider.php @@ -41,9 +41,20 @@ public static function getSubscribedEvents(): array public function onKernelRequest(RequestEvent $event): void { - if ($event->isMasterRequest()) { - $this->httpRequest = $event->getRequest(); - $this->timestampStart = microtime(true); + if (method_exists($event, 'isMainRequest')) { // Symfony >= 5.3 + if ($event->isMainRequest()) { + $this->httpRequest = $event->getRequest(); + $this->timestampStart = microtime(true); + } + + return; + } + + if (method_exists($event, 'isMasterRequest')) { // Symfony < 5.3 + if ($event->isMasterRequest()) { + $this->httpRequest = $event->getRequest(); + $this->timestampStart = microtime(true); + } } } diff --git a/src/DependencyInjection/TreblleFactory.php b/src/DependencyInjection/TreblleFactory.php index 8bdc3ad..5373c3f 100644 --- a/src/DependencyInjection/TreblleFactory.php +++ b/src/DependencyInjection/TreblleFactory.php @@ -25,7 +25,6 @@ public static function createTreblle( ErrorDataProvider $errorDataProvider ): Treblle { return new Treblle( - $configuration->getEndpointUrl(), $configuration->getApiKey(), $configuration->getProjectId(), $client, diff --git a/tests/TreblleIntegrationTest.php b/tests/TreblleIntegrationTest.php index 4a1b4d6..f380d50 100644 --- a/tests/TreblleIntegrationTest.php +++ b/tests/TreblleIntegrationTest.php @@ -79,7 +79,6 @@ protected function setUp(): void $this->dataProvider = new DataProvider(new PayloadAnonymizer([])); $this->treblle = new Treblle( - 'http://127.0.0.1', 'my api key', 'my project id', $client,