Skip to content

Commit

Permalink
chore: update rector to 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed Feb 17, 2024
1 parent 9dc116b commit 3f1fea2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 34 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "1.10.58",
"phpunit/phpunit": "^9.6",
"rector/rector": "0.15.2",
"rector/rector": "1.0.1",
"symfony/yaml": "^6.4 || ^7.0",
"symplify/phpstan-rules": "^12.4",
"tomasvotruba/cognitive-complexity": "^0.2.3",
Expand Down
3 changes: 2 additions & 1 deletion ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

declare (strict_types=1);

use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $config): void {
Expand All @@ -20,7 +21,7 @@
__DIR__ . '/Documentation/CodeSnippets',
__DIR__ . '/Tests',
]);
$config->ruleWithConfiguration(\PhpCsFixer\Fixer\Comment\HeaderCommentFixer::class, [
$config->ruleWithConfiguration(HeaderCommentFixer::class, [
'comment_type' => 'comment',
'header' => $header,
'separate' => 'both',
Expand Down
51 changes: 19 additions & 32 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,32 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector;
use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_81);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_81,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_EXCEPTION,
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::TYPE_DECLARATION,
]);

$rectorConfig->autoloadPaths([
__DIR__ . '/.Build/vendor/autoload.php',
]);
$rectorConfig->importShortClasses(false);
$rectorConfig->importNames();
$rectorConfig->paths([
return RectorConfig::configure()
->withPaths([
__DIR__ . '/Classes',
__DIR__ . '/Tests',
]);
$rectorConfig->skip([
])
->withPhpSets()
->withAutoloadPaths([
__DIR__ . '/.Build/vendor/autoload.php',
])
->withImportNames(
importShortClasses: false,
removeUnusedImports: true,
)
->withPreparedSets(
deadCode: true,
codeQuality: true,
typeDeclarations: true,
earlyReturn: true,
)
->withRootFiles()
->withSkip([
AddLiteralSeparatorToNumberRector::class,
AddReturnTypeDeclarationFromYieldsRector::class => [
__DIR__ . '/Tests',
],
RemoveAlwaysTrueIfConditionRector::class => [
__DIR__ . '/Classes/Renderer/JsonRenderer.php',
],
]);
};

0 comments on commit 3f1fea2

Please sign in to comment.