From 1229a18de4b550bda49bbc845f7e9f750d8c49f3 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 19 Nov 2024 15:02:43 +0100 Subject: [PATCH] [rector] add more default sets, bump php cs fixer, phpunit --- composer.json | 4 ++-- rector.php | 28 ++++++++++++---------------- tests/phpstan/object-manager.php | 2 +- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index c171ef50..d2ae4d22 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "symfony/twig-bundle": "^6.3" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.41", + "friendsofphp/php-cs-fixer": "^3.64", "jangregor/phpstan-prophecy": "^1.0", "phpcr/phpcr-shell": "^1.5", "phpspec/prophecy-phpunit": "^2.1", @@ -63,7 +63,7 @@ "phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-symfony": "^1.3", "phpstan/phpstan-webmozart-assert": "^1.2", - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^10.5", "rector/rector": "^1.0", "sulu/sulu-rector": "^1.0", "symfony/browser-kit": "^6.3", diff --git a/rector.php b/rector.php index f21fe731..6f1a78c9 100644 --- a/rector.php +++ b/rector.php @@ -11,27 +11,23 @@ __DIR__ . '/tests', ]) ->withRootFiles() - ->withPHPStanConfigs([ - __DIR__ . '/phpstan.dist.neon', - // rector does not load phpstan extension automatically so require them manually here: - __DIR__ . '/vendor/phpstan/phpstan-doctrine/extension.neon', - __DIR__ . '/vendor/phpstan/phpstan-symfony/extension.neon', - ]) - ->withImportNames(importShortClasses: false) - ->withPreparedSets(codeQuality: true, doctrineCodeQuality: true) - ->withPhpSets() - // symfony rules - ->withSymfonyContainerPhp(__DIR__ . '/var/cache/website/dev/App_KernelDevDebugContainer.xml') + ->withPhpSets() + ->withPreparedSets(codeQuality: true, doctrineCodeQuality: true, symfonyCodeQuality: true, deadCode: true, codingStyle: true, instanceOf: true, typeDeclarations: true) + ->withImportNames(importShortClasses: false) + ->withAttributesSets(all: true) ->withSets([ - SymfonySetList::SYMFONY_CODE_QUALITY, - SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION, // activate when doing updates: // SymfonyLevelSetList::UP_TO_SYMFONY_63, - // activate when doing updates: - // PHPUnitLevelSetList::UP_TO_PHPUNIT_90, - // PHPUnitSetList::PHPUNIT_91, // sulu rules // activate for updates when doing updates: // SuluLevelSetList::UP_TO_SULU_25, + ]) + // symfony rules + ->withSymfonyContainerPhp(__DIR__ . '/var/cache/website/dev/App_KernelDevDebugContainer.xml') + ->withPHPStanConfigs([ + __DIR__ . '/phpstan.dist.neon', + // rector does not load phpstan extension automatically so require them manually here: + __DIR__ . '/vendor/phpstan/phpstan-doctrine/extension.neon', + __DIR__ . '/vendor/phpstan/phpstan-symfony/extension.neon', ]); diff --git a/tests/phpstan/object-manager.php b/tests/phpstan/object-manager.php index 23b549c8..2e2b66ac 100644 --- a/tests/phpstan/object-manager.php +++ b/tests/phpstan/object-manager.php @@ -23,7 +23,7 @@ // this is a workaround for the following phpstan issue: https://github.com/phpstan/phpstan-doctrine/issues/98 $resolveTargetEntityListener = \current(\array_filter( $objectManager->getEventManager()->getListeners('loadClassMetadata'), - static fn ($listener) => $listener instanceof ResolveTargetEntityListener, + static fn ($listener): bool => $listener instanceof ResolveTargetEntityListener, )); if (false !== $resolveTargetEntityListener) {