Skip to content

Commit

Permalink
[rector] add more default sets, bump php cs fixer, phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Nov 19, 2024
1 parent 5c5b486 commit ed77ec4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
22 changes: 10 additions & 12 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,25 @@
__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()
->withPreparedSets(codeQuality: true, doctrineCodeQuality: true, symfonyCodeQuality: true, deadCode: true, codingStyle: true, instanceOf: true, typeDeclarations: true)
->withImportNames(importShortClasses: false)
->withAttributesSets(all: true)

// symfony rules
->withSymfonyContainerPhp(__DIR__ . '/var/cache/website/dev/App_KernelDevDebugContainer.xml')
->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,
])
->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',
]);
2 changes: 1 addition & 1 deletion tests/phpstan/object-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ed77ec4

Please sign in to comment.