diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d59c2fa..60bddf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,10 @@ jobs: SYMFONY_REQUIRE: 5.4.* - php: 8.0 - php: 8.1 - SYMFONY_REQUIRE: 6.2.* - - php: 8.2 SYMFONY_REQUIRE: 6.3.* + - php: 8.2 + SYMFONY_REQUIRE: 7.0.* + stability: dev steps: - uses: actions/checkout@v2 @@ -33,6 +34,9 @@ jobs: - name: Configure Composer minimum stability if: matrix.stability run: composer config minimum-stability ${{ matrix.stability }} + + - name: Remove cs fixer + run: composer remove --dev friendsofphp/php-cs-fixer --no-update - name: Install symfony/flex run: | @@ -57,7 +61,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "7.4" + php-version: "8.2" - name: Install dependencies run: composer update --prefer-dist @@ -75,7 +79,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.0" + php-version: "8.2" - name: Install dependencies run: composer update --prefer-dist diff --git a/composer.json b/composer.json index d27735c..6e35729 100644 --- a/composer.json +++ b/composer.json @@ -13,21 +13,22 @@ ], "require": { "php": "^7.2 || ^8.0", - "symfony/framework-bundle": "^5.4 || ^6.2", - "symfony/twig-bundle": "^5.4 || ^6.2", + "symfony/framework-bundle": "^5.4 || ^6.3 || ^7.0", + "symfony/twig-bundle": "^5.4 || ^6.3 || ^7.0", "twig/twig": "^1.35 || ^2.4.4 || ^3.0" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^3.27", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.5", "phpstan/phpstan-symfony": "^1.0", "phpunit/phpunit": "^8.5 || ^9.5", - "symfony/browser-kit": "^5.4 || ^6.2", - "symfony/css-selector": "^5.4 || ^6.2", - "symfony/expression-language": "^5.4 || ^6.2", - "symfony/phpunit-bridge": "^5.4 || ^6.2", - "symfony/security-bundle": "^5.4 || ^6.2", - "symfony/yaml": "5.4 || ^6.2" + "symfony/browser-kit": "^5.4 || ^6.3 || ^7.0", + "symfony/css-selector": "^5.4 || ^6.3 || ^7.0", + "symfony/expression-language": "^5.4 || ^6.3 || ^7.0", + "symfony/phpunit-bridge": "^6.3", + "symfony/security-bundle": "^5.4 || ^6.3 || ^7.0", + "symfony/yaml": "5.4 || ^6.3 || ^7.0" }, "autoload": { "psr-4": { diff --git a/makefile b/makefile index 20d88bc..3fd5c68 100644 --- a/makefile +++ b/makefile @@ -4,16 +4,12 @@ clear_cache: test: clear_cache vendor/bin/phpunit -c tests tests - make phpstan phpstan: vendor/bin/phpstan analyse -c phpstan.neon -l max src/ -php_cs_fixer_fix: php-cs-fixer.phar - ./php-cs-fixer.phar fix --config .php-cs-fixer.php src tests +php_cs_fixer_fix: + vendor/bin/php-cs-fixer fix --config .php-cs-fixer.php src tests -php_cs_fixer_check: php-cs-fixer.phar - ./php-cs-fixer.phar fix --config .php-cs-fixer.php src tests --dry-run --diff - -php-cs-fixer.phar: - wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.1.0/php-cs-fixer.phar && chmod 777 php-cs-fixer.phar +php_cs_fixer_check: + vendor/bin/php-cs-fixer fix --config .php-cs-fixer.php src tests --dry-run --diff diff --git a/src/MenuConfig/MenuConfigProvider.php b/src/MenuConfig/MenuConfigProvider.php index b87230b..c0fedf0 100644 --- a/src/MenuConfig/MenuConfigProvider.php +++ b/src/MenuConfig/MenuConfigProvider.php @@ -18,9 +18,9 @@ public function addMenuConfig(string $name, array $config): void } /** - * @throws \InvalidArgumentException - * * @return array + * + * @throws \InvalidArgumentException */ public function getMenuConfig(string $name): array { diff --git a/src/Node/Node.php b/src/Node/Node.php index abad5cc..2634a19 100644 --- a/src/Node/Node.php +++ b/src/Node/Node.php @@ -74,14 +74,14 @@ class Node /** * @var bool|null */ - protected $ifTrue = null; + protected $ifTrue; /** * @var bool */ protected $removeIfNoChildren = false; - public function __construct(?string $label = null) + public function __construct(string $label = null) { $this->label = $label; $this->id = self::$counter++; @@ -134,7 +134,7 @@ public function endIf(): self /** * @throws \BadMethodCallException */ - public function child(?string $label = null): self + public function child(string $label = null): self { if (!$this->nodeFactory) { throw new \BadMethodCallException('nodeFactory needs to be set on this node to be able @@ -183,7 +183,7 @@ public function getLayer(): int return $this->parent->getLayer() + 1; } - return 0; //root + return 0; // root } /** @@ -247,9 +247,9 @@ public function getAdditionalActiveRoutes(): array } /** - * @param mixed $value - * * @return $this + * + * @phpstan-ignore-next-line */ public function setAttr(string $key, $value): self { diff --git a/src/Node/NodeFactory.php b/src/Node/NodeFactory.php index 8549921..e43f2f8 100644 --- a/src/Node/NodeFactory.php +++ b/src/Node/NodeFactory.php @@ -4,7 +4,7 @@ final class NodeFactory implements NodeFactoryInterface { - public function create(?string $label = null): Node + public function create(string $label = null): Node { $node = new Node($label); $node->setNodeFactory($this); diff --git a/src/Node/NodeFactoryInterface.php b/src/Node/NodeFactoryInterface.php index ee7252f..206d486 100644 --- a/src/Node/NodeFactoryInterface.php +++ b/src/Node/NodeFactoryInterface.php @@ -4,5 +4,5 @@ interface NodeFactoryInterface { - public function create(?string $label = null): Node; + public function create(string $label = null): Node; } diff --git a/src/NodeVisitor/NodeActivator.php b/src/NodeVisitor/NodeActivator.php index 564b0b5..09515bf 100644 --- a/src/NodeVisitor/NodeActivator.php +++ b/src/NodeVisitor/NodeActivator.php @@ -20,9 +20,6 @@ public function __construct(RequestStack $requestStack) $this->requestStack = $requestStack; } - /** - * {@inheritdoc} - */ public function visit(Node $node): void { if (!$request = $this->requestStack->getCurrentRequest()) { diff --git a/src/NodeVisitor/NodeFilter.php b/src/NodeVisitor/NodeFilter.php index 530683a..9b33346 100644 --- a/src/NodeVisitor/NodeFilter.php +++ b/src/NodeVisitor/NodeFilter.php @@ -30,9 +30,6 @@ public function __construct( $this->authChecker = $authChecker; } - /** - * {@inheritdoc} - */ public function visit(Node $node) { foreach ($node->getRequiredPermissions() as $permission) { diff --git a/src/NodeVisitor/NodeRoutePropagator.php b/src/NodeVisitor/NodeRoutePropagator.php index 140bb91..8e68fdb 100644 --- a/src/NodeVisitor/NodeRoutePropagator.php +++ b/src/NodeVisitor/NodeRoutePropagator.php @@ -9,9 +9,6 @@ */ final class NodeRoutePropagator implements NodeVisitorInterface { - /** - * {@inheritdoc} - */ public function visit(Node $node): void { $parent = $node->getParent(); diff --git a/tests/Functional/FunctionalTest.php b/tests/Functional/FunctionalTest.php index aa8aff2..a6cbf21 100644 --- a/tests/Functional/FunctionalTest.php +++ b/tests/Functional/FunctionalTest.php @@ -63,7 +63,7 @@ private function loginUser(KernelBrowser $client, string $username, string $pass return; } - //TODO: cleanup once Symfony 4.4 support is dropped + // TODO: cleanup once Symfony 4.4 support is dropped $token = new UsernamePasswordToken($user, $user->getPassword(), 'main', $user->getRoles()); $container = self::$kernel->getContainer()->get('test.service_container'); diff --git a/tests/Functional/config.php b/tests/Functional/config.php index f25ab00..08395ff 100644 --- a/tests/Functional/config.php +++ b/tests/Functional/config.php @@ -1,29 +1,22 @@ 'session.storage.factory.mock_file']; - $securityConfig = [ - 'password_hashers' => [ - InMemoryUser::class => 'plain', - ], - 'enable_authenticator_manager' => true, - ]; - } else { - $sessionConfig = ['storage_id' => 'session.storage.mock_file']; - $securityConfig = [ - 'encoders' => [ - User::class => 'plain', - ], - ]; + $securityConfig = [ + 'password_hashers' => [ + InMemoryUser::class => 'plain', + ], + ]; + + if (Kernel::VERSION_ID < 70000) { + $securityConfig['enable_authenticator_manager'] = true; } $container->extension('framework', [ - 'session' => $sessionConfig, + 'session' => ['storage_factory_id' => 'session.storage.factory.mock_file'], ]); $container->extension('security', $securityConfig); diff --git a/tests/NodeVisitor/NodeActivatorTest.php b/tests/NodeVisitor/NodeActivatorTest.php index 3c25378..6585fcf 100644 --- a/tests/NodeVisitor/NodeActivatorTest.php +++ b/tests/NodeVisitor/NodeActivatorTest.php @@ -22,8 +22,6 @@ public function setUp(): void * @dataProvider getTestData * * @param string $route - * @param $requestRoute - * @param $expectedIsActive */ public function testVisit($route, array $routes, $requestRoute, $expectedIsActive): void {