Skip to content

Commit

Permalink
Conflict with Symfony <5.3, so we can safely use MainRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandoorn committed Jan 3, 2024
1 parent ccfdebc commit 1efff56
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"sylius",
"sylius-plugin"
],
"conflicts": {
"symfony/http-foundation": "<5.3"
},
"require": {
"php": "^7.4 || ^8.0",
"stefandoorn/google-tag-manager-plugin": "~1.0",
Expand Down
10 changes: 1 addition & 9 deletions src/Helper/MainRequest/ControllerEventMainRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ final class ControllerEventMainRequest
{
public static function isMainRequest(ControllerEvent $event): bool
{
if (\method_exists($event, 'isMainRequest')) {
return $event->isMainRequest();
}

if (\method_exists($event, 'isMasterRequest')) {
return $event->isMasterRequest();
}

throw new \Exception('Neither "isMainRequest" or "isMasterRequest" exists');
return $event->isMainRequest();
}
}
10 changes: 1 addition & 9 deletions src/Helper/MainRequest/RequestStackMainRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@ final class RequestStackMainRequest
{
public static function getMainRequest(RequestStack $requestStack): Request
{
if (\method_exists($requestStack, 'getMainRequest')) {
return $requestStack->getMainRequest();
}

if (\method_exists($requestStack, 'getMasterRequest')) {
return $requestStack->getMasterRequest();
}

throw new \Exception('Neither "getMainRequest" or "getMasterRequest" exists');
return $requestStack->getMainRequest();
}

public static function isMainRequest(RequestStack $requestStack): bool
Expand Down

0 comments on commit 1efff56

Please sign in to comment.