diff --git a/EventListener/ScriptNameConfigureListener.php b/EventListener/ScriptNameConfigureListener.php index 56809ec..9c739ae 100644 --- a/EventListener/ScriptNameConfigureListener.php +++ b/EventListener/ScriptNameConfigureListener.php @@ -3,21 +3,26 @@ namespace Intaro\PinbaBundle\EventListener; use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpKernel\Event\KernelEvent; +use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; class ScriptNameConfigureListener { - public function onRequest(GetResponseEvent $event) + public function onRequest(KernelEvent $event) { + if (!($event instanceof GetResponseEvent || $event instanceof RequestEvent)) { + throw new \InvalidArgumentException('Event must be GetResponseEvent or RequestEvent'); + } + if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { return; } - if (!function_exists('pinba_script_name_set') || PHP_SAPI === 'cli') { + if (!function_exists('pinba_script_name_set') || \PHP_SAPI === 'cli') { return; } pinba_script_name_set($event->getRequest()->getRequestUri()); } -} \ No newline at end of file +} diff --git a/composer.json b/composer.json index cc74ca4..e4605cb 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,8 @@ }], "require": { "php": ">=5.3.0", - "symfony/framework-bundle" : "~2.3|~3.0|^4.0", - "symfony/yaml": "~2.2|~3.0|^4.0" + "symfony/framework-bundle" : "~2.8|~3.0|^4.0|^5.0", + "symfony/yaml": "~2.8|~3.0|^4.0|^5.0" }, "autoload": { "psr-0": {