diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d7e1088d0..16fef0939 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -36,7 +36,6 @@ jobs: strategy: matrix: php-version: - - '8.0' - '8.1' - '8.2' - '8.3' @@ -45,30 +44,25 @@ jobs: symfony-require: [''] variant: [normal] include: - - php-version: '8.0' + - php-version: '8.1' dependencies: lowest allowed-to-fail: false variant: normal - php-version: '8.3' dependencies: highest allowed-to-fail: false - symfony-require: 5.4.* - variant: symfony/symfony:"5.4.*" - - php-version: '8.3' - dependencies: highest - allowed-to-fail: false - symfony-require: 6.3.* - variant: symfony/symfony:"6.3.*" + symfony-require: 6.4.* + variant: symfony/symfony:"6.4.*" - php-version: '8.3' dependencies: highest allowed-to-fail: false - symfony-require: 6.4.* - variant: symfony/symfony:"6.4.*" + symfony-require: 7.1.* + variant: symfony/symfony:"7.1.*" - php-version: '8.3' dependencies: highest allowed-to-fail: false - symfony-require: 7.0.* - variant: symfony/symfony:"7.0.*" + symfony-require: 7.2.* + variant: symfony/symfony:"7.2.*" steps: - name: Checkout diff --git a/composer.json b/composer.json index 310d2a299..da79e645a 100644 --- a/composer.json +++ b/composer.json @@ -20,29 +20,29 @@ ], "homepage": "https://docs.sonata-project.org/projects/SonataUserBundle", "require": { - "php": "^8.0", + "php": "^8.1", "doctrine/collections": "^1.6 || ^2.0", "doctrine/common": "^3.1", "doctrine/persistence": "^3.0.2", "sonata-project/doctrine-extensions": "^1.13 || ^2.0", "sonata-project/form-extensions": "^1.4 || ^2.0", "sonata-project/twig-extensions": "^1.3 || ^2.0", - "symfony/config": "^5.4 || ^6.2 || ^7.0", - "symfony/console": "^5.4 || ^6.2 || ^7.0", - "symfony/dependency-injection": "^5.4 || ^6.2 || ^7.0", - "symfony/event-dispatcher": "^5.4 || ^6.2 || ^7.0", - "symfony/form": "^5.4 || ^6.2 || ^7.0", - "symfony/framework-bundle": "^5.4 || ^6.2 || ^7.0", - "symfony/http-foundation": "^5.4 || ^6.2 || ^7.0", - "symfony/http-kernel": "^5.4 || ^6.2 || ^7.0", - "symfony/options-resolver": "^5.4 || ^6.2 || ^7.0", - "symfony/routing": "^5.4 || ^6.2 || ^7.0", + "symfony/config": "^6.4 || ^7.1", + "symfony/console": "^6.4 || ^7.1", + "symfony/dependency-injection": "^6.4 || ^7.1", + "symfony/event-dispatcher": "^6.4 || ^7.1", + "symfony/form": "^6.4 || ^7.1", + "symfony/framework-bundle": "^6.4 || ^7.1", + "symfony/http-foundation": "^6.4 || ^7.1", + "symfony/http-kernel": "^6.4 || ^7.1", + "symfony/options-resolver": "^6.4 || ^7.1", + "symfony/routing": "^6.4 || ^7.1", "symfony/security-acl": "^3.0", - "symfony/security-core": "^5.4 || ^6.2 || ^7.0", - "symfony/security-csrf": "^5.4 || ^6.2 || ^7.0", - "symfony/translation": "^5.4 || ^6.2 || ^7.0", + "symfony/security-core": "^6.4 || ^7.1", + "symfony/security-csrf": "^6.4 || ^7.1", + "symfony/translation": "^6.4 || ^7.1", "symfony/translation-contracts": "^2.5 || ^3.0", - "symfony/validator": "^5.4 || ^6.2 || ^7.0", + "symfony/validator": "^6.4 || ^7.1", "twig/twig": "^3.0" }, "require-dev": { @@ -64,16 +64,16 @@ "psalm/plugin-phpunit": "^0.18", "psalm/plugin-symfony": "^5.0", "rector/rector": "^1.1", - "sonata-project/admin-bundle": "^4.20", + "sonata-project/admin-bundle": "^4.34", "sonata-project/block-bundle": "^4.11 || ^5.0", "sonata-project/doctrine-orm-admin-bundle": "^4.0", - "symfony/browser-kit": "^5.4 || ^6.2 || ^7.0", - "symfony/console": "^5.4 || ^6.2 || ^7.0", - "symfony/filesystem": "^5.4 || ^6.2 || ^7.0", - "symfony/intl": "^5.4 || ^6.2 || ^7.0", - "symfony/mailer": "^5.4 || ^6.2 || ^7.0", - "symfony/mime": "^5.4 || ^6.2 || ^7.0", - "symfony/phpunit-bridge": "^6.2 || ^7.0", + "symfony/browser-kit": "^6.4 || ^7.1", + "symfony/console": "^6.4 || ^7.1", + "symfony/filesystem": "^6.4 || ^7.1", + "symfony/intl": "^6.4 || ^7.1", + "symfony/mailer": "^6.4 || ^7.1", + "symfony/mime": "^6.4 || ^7.1", + "symfony/phpunit-bridge": "^6.4 || ^7.1", "vimeo/psalm": "^5.0" }, "conflict": { diff --git a/rector.php b/rector.php index 744632387..254341a3b 100644 --- a/rector.php +++ b/rector.php @@ -19,6 +19,8 @@ use Rector\Config\RectorConfig; use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector; +use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; +use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; use Rector\PHPUnit\Set\PHPUnitSetList; @@ -31,7 +33,7 @@ ]); $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_80, + LevelSetList::UP_TO_PHP_81, PHPUnitSetList::PHPUNIT_90, PHPUnitSetList::PHPUNIT_CODE_QUALITY, ]); @@ -40,6 +42,8 @@ $rectorConfig->importShortClasses(false); $rectorConfig->skip([ ExceptionHandlerTypehintRector::class, + ReadOnlyPropertyRector::class, + NullToStrictStringFuncCallArgRector::class, PreferPHPUnitThisCallRector::class, NarrowUnusedSetUpDefinedPropertyRector::class, ]); diff --git a/src/Action/CheckLoginAction.php b/src/Action/CheckLoginAction.php index 1ccfd76d2..4b02176e3 100644 --- a/src/Action/CheckLoginAction.php +++ b/src/Action/CheckLoginAction.php @@ -15,7 +15,7 @@ final class CheckLoginAction { - public function __invoke(): void + public function __invoke(): never { throw new \RuntimeException('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.'); } diff --git a/src/Action/LogoutAction.php b/src/Action/LogoutAction.php index 3923475e7..d324382ce 100644 --- a/src/Action/LogoutAction.php +++ b/src/Action/LogoutAction.php @@ -15,7 +15,7 @@ final class LogoutAction { - public function __invoke(): void + public function __invoke(): never { throw new \RuntimeException('You must activate the logout in your security firewall configuration.'); } diff --git a/src/Model/User.php b/src/Model/User.php index a1d5fa28c..53b95f977 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -123,7 +123,12 @@ public function getUsername(): ?string public function getUserIdentifier(): string { - return $this->getUsername() ?? '-'; + $username = $this->getUsername(); + if (null === $username || '' === $username) { + return '-'; + } + + return $username; } public function getUsernameCanonical(): ?string diff --git a/src/Twig/RolesMatrixExtension.php b/src/Twig/RolesMatrixExtension.php index 6a0238a16..f9e7cd9fb 100644 --- a/src/Twig/RolesMatrixExtension.php +++ b/src/Twig/RolesMatrixExtension.php @@ -33,10 +33,10 @@ public function __construct(private MatrixRolesBuilderInterface $rolesBuilder) public function getFunctions(): array { return [ - new TwigFunction('renderMatrix', [$this, 'renderMatrix'], ['needs_environment' => true]), + new TwigFunction('renderMatrix', $this->renderMatrix(...), ['needs_environment' => true]), new TwigFunction( 'renderRolesList', - [$this, 'renderRolesList'], + $this->renderRolesList(...), ['needs_environment' => true] ), ]; diff --git a/tests/Action/CheckLoginActionTest.php b/tests/Action/CheckLoginActionTest.php index 6c0fee2c6..8f4d2ca21 100644 --- a/tests/Action/CheckLoginActionTest.php +++ b/tests/Action/CheckLoginActionTest.php @@ -18,7 +18,7 @@ final class CheckLoginActionTest extends TestCase { - public function testAction(): void + public function testAction(): never { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.'); diff --git a/tests/Action/LogoutActionTest.php b/tests/Action/LogoutActionTest.php index bc07746cd..8faa6a21a 100644 --- a/tests/Action/LogoutActionTest.php +++ b/tests/Action/LogoutActionTest.php @@ -18,7 +18,7 @@ final class LogoutActionTest extends TestCase { - public function testAction(): void + public function testAction(): never { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('You must activate the logout in your security firewall configuration.');