Skip to content

Commit

Permalink
Merge pull request #23 from martinlutter/symfony6
Browse files Browse the repository at this point in the history
update to support symfony 6
  • Loading branch information
martinlutter authored Nov 15, 2022
2 parents 41d0e5e + d7704e9 commit d94f927
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ class ItemFilteredByRole implements Everlution\Navigation\Item\ItemInterface, Ev
public function getSupportedRoles(): array
{
return [
'IS_AUTHENTICATED_ANONYMOUSLY',
'PUBLIC_ACCESS',
];
}
}
Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
}
},
"require": {
"php": "^7.1|^8.0",
"symfony/framework-bundle": "^3.0|^4.0",
"symfony/config": "^3.0|^4.0",
"symfony/dependency-injection": "^3.0|^4.0",
"symfony/http-foundation": "^3.0|^4.0",
"symfony/http-kernel": "^3.0|^4.0",
"symfony/routing": "^3.0|^4.0",
"symfony/security": "^3.0|^4.0",
"symfony/translation": "^3.0|^4.0",
"symfony/twig-bundle": "^3.0|^4.0",
"php": "^8.0.2",
"symfony/framework-bundle": ">=6.0",
"symfony/config": ">=6.0",
"symfony/dependency-injection": ">=6.0",
"symfony/http-foundation": ">=6.0",
"symfony/http-kernel": ">=6.0",
"symfony/routing": ">=6.0",
"symfony/security-core": ">=6.0",
"symfony/translation": ">=6.0",
"symfony/twig-bundle": ">=6.0",
"everlutionsk/navigation": "^2.4"
},
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions src/Bridge/Filter/RolesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public function getRoles(): array
{
try {
return array_merge(
$this->tokenStorage->getToken()->getUser()->getRoles(),
$this->tokenStorage->getToken()?->getUser()?->getRoles(),
['IS_AUTHENTICATED_FULLY']
);
} catch (\Exception $exception) {
return ['IS_AUTHENTICATED_ANONYMOUSLY'];
return ['PUBLIC_ACCESS'];
}
}
}
2 changes: 1 addition & 1 deletion src/Bridge/Item/RequestAttributesContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(RequestStack $requestStack)

public function get(string $name, string $default = ''): string
{
$request = $this->requestStack->getMasterRequest();
$request = $this->requestStack->getMainRequest();

if (!$request) {
return '';
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Matcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Matcher implements MatcherInterface

public function __construct(RequestStack $requestStack, UrlMatchVoterInterface $voter)
{
$this->request = $requestStack->getMasterRequest();
$this->request = $requestStack->getMainRequest();
$this->voter = $voter;
}

Expand Down
10 changes: 5 additions & 5 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class Configuration implements ConfigurationInterface

public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('everlution_navigation');

$rootNode
$treeBuilder = new TreeBuilder('everlution_navigation');
$treeBuilder
->getRootNode()
->children()
->scalarNode(self::CONFIG_ROUTER_SERVICE)->defaultValue('router.default')->end()
->end();
->end()
;

return $treeBuilder;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Twig/ItemExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
use Everlution\Navigation\Builder\MatcherInterface;
use Everlution\NavigationBundle\Bridge\Item\Container\ItemContainerInterface;
use Twig\Environment;
use Twig\Extension\AbstractExtension;

/**
* Class ItemExtension.
*
* @author Ivan Barlog <[email protected]>
*/
class ItemExtension extends \Twig_Extension
class ItemExtension extends AbstractExtension
{
/** @var NavigationHelper */
private $helper;
Expand Down
2 changes: 1 addition & 1 deletion src/Twig/ItemHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Everlution\Navigation\Url\CannotProvideUrlForItemException;
use Everlution\Navigation\Url\UrlProviderContainer;
use Everlution\NavigationBundle\Bridge\Item\TranslatableItemLabelInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

/**
* Class Helper.
Expand Down
3 changes: 2 additions & 1 deletion src/Twig/NavigationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

use Everlution\Navigation\Builder\NoCurrentItemFoundException;
use Twig\Environment;
use Twig\Extension\AbstractExtension;

/**
* Class NavigationExtension.
*
* @author Ivan Barlog <[email protected]>
*/
class NavigationExtension extends \Twig_Extension
class NavigationExtension extends AbstractExtension
{
/** @var ItemHelper */
private $helper;
Expand Down

0 comments on commit d94f927

Please sign in to comment.