diff --git a/composer.json b/composer.json index a2399fd..68da3a3 100644 --- a/composer.json +++ b/composer.json @@ -8,9 +8,10 @@ } }, "require": { + "php": "^8.3", "slevomat/coding-standard": "^8.14.1", "symplify/easy-coding-standard": "^12.1.8", - "rector/rector": "^0.19.2" + "rector/rector": "^0.19.5" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index 03cb2b0..bb4ab7c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a2ee536230b7262151afd736f0600119", + "content-hash": "da852e748b3a7adc9b558b097386ff95", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -195,16 +195,16 @@ }, { "name": "rector/rector", - "version": "0.19.2", + "version": "0.19.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903" + "reference": "89c895d127b9d248d2af007068a824b5348ef81f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/bc96a99895bf47c6bfe70ea1b799f0081ed5a903", - "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/89c895d127b9d248d2af007068a824b5348ef81f", + "reference": "89c895d127b9d248d2af007068a824b5348ef81f", "shasum": "" }, "require": { @@ -239,7 +239,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.19.2" + "source": "https://github.com/rectorphp/rector/tree/0.19.5" }, "funding": [ { @@ -247,7 +247,7 @@ "type": "github" } ], - "time": "2024-01-19T10:58:30+00:00" + "time": "2024-01-29T23:53:47+00:00" }, { "name": "slevomat/coding-standard", @@ -459,7 +459,9 @@ "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "php": "^8.3" + }, "platform-dev": [], "plugin-api-version": "2.6.0" } diff --git a/config/ecs.php b/config/ecs.php index f05925b..6e83916 100644 --- a/config/ecs.php +++ b/config/ecs.php @@ -2,6 +2,8 @@ use PhpCsFixer\Fixer\Import\OrderedImportsFixer; use PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer; +use PhpCsFixer\Fixer\Operator\NewWithBracesFixer; +use PhpCsFixer\Fixer\Operator\NewWithParenthesesFixer; use PhpCsFixer\Fixer\Operator\OperatorLinebreakFixer; use PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer; use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer; @@ -22,21 +24,21 @@ use Symplify\EasyCodingStandard\Config\ECSConfig; return ECSConfig::configure() ->withPreparedSets( + symplify: true, arrays: true, - cleanCode: true, comments: true, - controlStructures: true, docblocks: true, - namespaces: true, spaces: true, + namespaces: true, + controlStructures: true, strict: true, - symplify: true + cleanCode: true ) ->withPhpCsFixerSets( perCS: true, perCSRisky: true, - php83Migration: true, php80MigrationRisky: true, + php83Migration: true, ) ->withRules([ AlphabeticallySortedUsesSniff::class, @@ -108,4 +110,6 @@ return ECSConfig::configure() BlankLineAfterOpeningTagFixer::class, OrderedImportsFixer::class, FunctionToConstantFixer::class, + NewWithParenthesesFixer::class, + NewWithBracesFixer::class, ]); diff --git a/config/rector.php b/config/rector.php index 4687fc7..82d5ac5 100644 --- a/config/rector.php +++ b/config/rector.php @@ -43,9 +43,9 @@ use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector; use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector; -return static function (RectorConfig $c): void { - $c->sets([LevelSetList::UP_TO_PHP_82]); - $c->rules([ +return RectorConfig::configure() + ->withSets([LevelSetList::UP_TO_PHP_83]) + ->withRules([ AddArrowFunctionReturnTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, AddParamTypeFromPropertyTypeRector::class, @@ -86,5 +86,5 @@ return static function (RectorConfig $c): void { ThrowWithPreviousExceptionRector::class, TypedPropertyFromStrictConstructorRector::class, RemoveAlwaysElseRector::class, - ]); -}; + ]) +; diff --git a/rector.php b/rector.php index 80408b1..87b24f1 100644 --- a/rector.php +++ b/rector.php @@ -3,13 +3,11 @@ use Lubiana\CodeQuality\LubiSetList; use Rector\Config\RectorConfig; -return static function (RectorConfig $c): void { - $c->paths([ +return RectorConfig::configure() + ->withPaths([ __DIR__ . '/src', __DIR__ . '/config', - __DIR__ . '/rector.php', - __DIR__ . '/ecs.php', - ]); - - $c->sets([LubiSetList::RECTOR]); -}; + ]) + ->withSets([LubiSetList::RECTOR]) + ->withRootFiles() +; diff --git a/src/LubiSetList.php b/src/LubiSetList.php index d78838d..87017c2 100644 --- a/src/LubiSetList.php +++ b/src/LubiSetList.php @@ -4,7 +4,7 @@ namespace Lubiana\CodeQuality; final class LubiSetList { - public const RECTOR = __DIR__ . '/../config/rector.php'; + public const string RECTOR = __DIR__ . '/../config/rector.php'; - public const ECS = __DIR__ . '/../config/ecs.php'; + public const string ECS = __DIR__ . '/../config/ecs.php'; }