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 12d4511
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 34 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"
],
"conflict": {
"symfony/http-foundation": "<5.3"
},
"require": {
"php": "^7.4 || ^8.0",
"stefandoorn/google-tag-manager-plugin": "~1.0",
Expand Down
16 changes: 0 additions & 16 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,3 @@ parameters:
# Test dependencies
- 'tests/Application/app/**.php'
- 'tests/Application/src/**.php'

ignoreErrors:
-
message: "#^Call to function method_exists\\(\\) with Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\ControllerEvent and 'isMainRequest' will always evaluate to true\\.$#"
count: 1
path: src/Helper/MainRequest/ControllerEventMainRequest.php

-
message: "#^Call to function method_exists\\(\\) with Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\ControllerEvent and 'isMasterRequest' will always evaluate to false\\.$#"
count: 1
path: src/Helper/MainRequest/ControllerEventMainRequest.php

-
message: "#^Call to function method_exists\\(\\) with Symfony\\\\Component\\\\HttpFoundation\\\\RequestStack and 'getMainRequest' will always evaluate to true\\.$#"
count: 1
path: src/Helper/MainRequest/RequestStackMainRequest.php
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 12d4511

Please sign in to comment.