Skip to content

Commit

Permalink
FRW-19 Support Symfony packages v6. (#9610)
Browse files Browse the repository at this point in the history
FRW-19 Support Symfony v6
  • Loading branch information
geega authored Jan 24, 2023
1 parent ed45023 commit 88ecb7e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
parameters:
level: 7
checkMissingIterableValueType: false
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- '#^Call to function method_exists\(\) with Symfony\\Component\\HttpKernel\\Event\\ControllerEvent and#'
- '#Call to an undefined method Symfony\\Component\\HttpKernel\\Event\\ControllerEvent\:\:isMainRequest\(\).#'

16 changes: 15 additions & 1 deletion src/Spryker/Yves/Monitoring/Plugin/ControllerListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function __construct(
*/
public function onKernelController(ControllerEvent $event): void
{
if (!$event->isMasterRequest()) {
if (!$this->isMainRequest($event)) {
return;
}

Expand Down Expand Up @@ -101,4 +101,18 @@ public static function getSubscribedEvents(): array
KernelEvents::CONTROLLER => ['onKernelController', static::PRIORITY],
];
}

/**
* @param \Symfony\Component\HttpKernel\Event\ControllerEvent $event
*
* @return bool
*/
protected function isMainRequest(ControllerEvent $event): bool
{
if (method_exists($event, 'isMasterRequest')) {
return $event->isMasterRequest();
}

return $event->isMainRequest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function __construct(
*/
public function onKernelController(ControllerEvent $event): void
{
if (!$event->isMasterRequest()) {
if (!$this->isMainRequest($event)) {
return;
}

Expand Down Expand Up @@ -152,4 +152,18 @@ protected function addStore(): void
$this->monitoringService->addCustomParameter('store', $this->storeFacade->getCurrentStore()->getName());
}
}

/**
* @param \Symfony\Component\HttpKernel\Event\ControllerEvent $event
*
* @return bool
*/
protected function isMainRequest(ControllerEvent $event): bool
{
if (method_exists($event, 'isMasterRequest')) {
return $event->isMasterRequest();
}

return $event->isMainRequest();
}
}

0 comments on commit 88ecb7e

Please sign in to comment.