Skip to content

Commit

Permalink
Fixed Symfony 5.3 RequestStack::getMasterRequest deprecation (#46)
Browse files Browse the repository at this point in the history
* Switch tests to Symfony 5.3

* Fixed RequestStack::getMasterRequest deprecation
  • Loading branch information
yann-eugone authored Jun 21, 2021
1 parent f9111f2 commit def927c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
- php-version: 8.0
symfony-version: 4.4.*
- php-version: 7.4
symfony-version: 5.2.*
symfony-version: 5.3.*
- php-version: 8.0
symfony-version: 5.2.*
symfony-version: 5.3.*

steps:
- name: "Checkout"
Expand Down
7 changes: 6 additions & 1 deletion src/InformationGuesser/InformationGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ public function __construct(RequestStack $requestStack)
*/
public function get(): array
{
$request = $this->requestStack->getMasterRequest();
if (\method_exists($this->requestStack, 'getMainRequest')) {
$request = $this->requestStack->getMainRequest();
} else {
$request = $this->requestStack->getMasterRequest();
}

if (!$request) {
return [];
}
Expand Down

0 comments on commit def927c

Please sign in to comment.