Skip to content

Commit

Permalink
allow Symfony 7 + drop support for 6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher committed Sep 22, 2023
1 parent 0136d5a commit 0c7022c
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 42 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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
Expand Down
17 changes: 9 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
12 changes: 4 additions & 8 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/MenuConfig/MenuConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public function addMenuConfig(string $name, array $config): void
}

/**
* @throws \InvalidArgumentException
*
* @return array<string, mixed>
*
* @throws \InvalidArgumentException
*/
public function getMenuConfig(string $name): array
{
Expand Down
10 changes: 4 additions & 6 deletions src/Node/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -183,7 +183,7 @@ public function getLayer(): int
return $this->parent->getLayer() + 1;
}

return 0; //root
return 0; // root
}

/**
Expand Down Expand Up @@ -247,8 +247,6 @@ public function getAdditionalActiveRoutes(): array
}

/**
* @param mixed $value
*
* @return $this
*/
public function setAttr(string $key, $value): self

Check failure on line 252 in src/Node/Node.php

View workflow job for this annotation

GitHub Actions / PHPStan

Method DAMA\MenuBundle\Node\Node::setAttr() has parameter $value with no type specified.
Expand Down
2 changes: 1 addition & 1 deletion src/Node/NodeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Node/NodeFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

interface NodeFactoryInterface
{
public function create(?string $label = null): Node;
public function create(string $label = null): Node;
}
3 changes: 0 additions & 3 deletions src/NodeVisitor/NodeActivator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ public function __construct(RequestStack $requestStack)
$this->requestStack = $requestStack;
}

/**
* {@inheritdoc}
*/
public function visit(Node $node): void
{
if (!$request = $this->requestStack->getCurrentRequest()) {
Expand Down
3 changes: 0 additions & 3 deletions src/NodeVisitor/NodeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ public function __construct(
$this->authChecker = $authChecker;
}

/**
* {@inheritdoc}
*/
public function visit(Node $node)
{
foreach ($node->getRequiredPermissions() as $permission) {
Expand Down
3 changes: 0 additions & 3 deletions src/NodeVisitor/NodeRoutePropagator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
*/
final class NodeRoutePropagator implements NodeVisitorInterface
{
/**
* {@inheritdoc}
*/
public function visit(Node $node): void
{
$parent = $node->getParent();
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 0 additions & 2 deletions tests/NodeVisitor/NodeActivatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 0c7022c

Please sign in to comment.