Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rector] make use of new config, and prepared set methods #259

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 14 additions & 38 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,35 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\SymfonySetList;
use Sulu\Rector\Set\SuluLevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([__DIR__ . '/src', __DIR__ . '/tests']);

$rectorConfig->phpstanConfigs([
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__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',
]);

// basic rules
$rectorConfig->importNames();
$rectorConfig->importShortClasses(false);

$rectorConfig->sets([
SetList::CODE_QUALITY,
LevelSetList::UP_TO_PHP_81,
]);
])
->withImportNames(importShortClasses: false)
->withPreparedSets(codeQuality: true, doctrineCodeQuality: true)
->withPhpSets()

// symfony rules
$rectorConfig->symfonyContainerPhp(__DIR__ . '/var/cache/website/dev/App_KernelDevDebugContainer.xml');

$rectorConfig->sets([
->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,
]);

// doctrine rules
$rectorConfig->sets([
DoctrineSetList::DOCTRINE_CODE_QUALITY,
]);

// phpunit rules
$rectorConfig->sets([
// activate when doing updates:
// PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
// PHPUnitSetList::PHPUNIT_91,
]);

// sulu rules
$rectorConfig->sets([
// sulu rules
// activate for updates when doing updates:
// SuluLevelSetList::UP_TO_SULU_25,
]);
};
Loading