diff --git a/bin/rector.php b/bin/rector.php index d42541061cd..07eea9a09cc 100755 --- a/bin/rector.php +++ b/bin/rector.php @@ -6,12 +6,10 @@ use Rector\Bootstrap\AutoloadFileParameterResolver; use Rector\Bootstrap\RectorConfigsResolver; use Rector\ChangesReporting\Output\JsonOutputFormatter; -use Rector\Config\RectorConfig; use Rector\Configuration\Option; use Rector\Console\Style\SymfonyStyleFactory; use Rector\DependencyInjection\LazyContainerFactory; use Rector\DependencyInjection\RectorContainerFactory; -use Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory; use Rector\Util\Reflection\PrivatesAccessor; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; diff --git a/composer.json b/composer.json index ed7fce6bd1f..268e11782ec 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "webmozart/assert": "^2.4" }, "require-dev": { - "boundwize/structarmed": "^0.14", + "boundwize/structarmed": "^0.15", "nette/robot-loader": "^4.1", "php-parallel-lint/php-parallel-lint": "^1.4", "phpstan/extension-installer": "^1.4", diff --git a/rules-tests/Renaming/Rector/Name/RenameClassRector/FixtureAutoImportNames/SomeShort.php b/rules-tests/Renaming/Rector/Name/RenameClassRector/FixtureAutoImportNames/SomeShort.php index a9bbd6152d3..81c22f6cfc2 100644 --- a/rules-tests/Renaming/Rector/Name/RenameClassRector/FixtureAutoImportNames/SomeShort.php +++ b/rules-tests/Renaming/Rector/Name/RenameClassRector/FixtureAutoImportNames/SomeShort.php @@ -4,6 +4,6 @@ namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\FixtureAutoImportNames; -class SomeShort +final class SomeShort { } diff --git a/rules/Php81/Rector/Array_/ArrayToFirstClassCallableRector.php b/rules/Php81/Rector/Array_/ArrayToFirstClassCallableRector.php index 30609679dce..6512455c472 100644 --- a/rules/Php81/Rector/Array_/ArrayToFirstClassCallableRector.php +++ b/rules/Php81/Rector/Array_/ArrayToFirstClassCallableRector.php @@ -31,7 +31,7 @@ * @see RFC https://wiki.php.net/rfc/first_class_callable_syntax * @see \Rector\Tests\Php81\Rector\Array_\ArrayToFirstClassCallableRector\ArrayToFirstClassCallableRectorTest */ -class ArrayToFirstClassCallableRector extends AbstractRector implements MinPhpVersionInterface +final class ArrayToFirstClassCallableRector extends AbstractRector implements MinPhpVersionInterface { public function __construct( private readonly ArrayCallableMethodMatcher $arrayCallableMethodMatcher, diff --git a/src/PhpParser/Node/FileNode.php b/src/PhpParser/Node/FileNode.php index c39b2d0c27b..4611c641578 100644 --- a/src/PhpParser/Node/FileNode.php +++ b/src/PhpParser/Node/FileNode.php @@ -22,7 +22,7 @@ /** * Inspired by https://github.com/phpstan/phpstan-src/commit/ed81c3ad0b9877e6122c79b4afda9d10f3994092 */ -class FileNode extends Stmt +final class FileNode extends Stmt { /** * Imports queued to be added on the next UseAddingPostRector run; scoped to this file diff --git a/structarmed.php b/structarmed.php index 61913483c8d..4a668b365fc 100644 --- a/structarmed.php +++ b/structarmed.php @@ -5,8 +5,13 @@ use Boundwize\StructArmed\Architecture; use Boundwize\StructArmed\Preset\Preset; use Boundwize\StructArmed\Preset\Presets\Psr4Preset; +use Boundwize\StructArmed\Rule\Rules\Class_\MustBeFinalRule; return Architecture::define() + ->rule( + 'source.must_be_final', + new MustBeFinalRule(layer: 'Source'), + ) ->skip([ Psr4Preset::CLASSES_MUST_MATCH_COMPOSER => [ // the namespace different is on purpose @@ -19,5 +24,8 @@ // simulate under phpstan.phar __DIR__ . '/rules-tests/Php71/Rector/FuncCall/RemoveExtraParametersRector/Source/phpstan.phar', ], + 'source.must_be_final' => [ + '*/Source/*', + ], ]) ->withPreset(Preset::PSR4());