From d717d056c98e43caa9facde460988c6b9bc61958 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 20 Jul 2026 21:52:30 +0700 Subject: [PATCH 1/3] Bump to StructArmed ^0.15 and enable MustBeFinalRule --- composer.json | 2 +- .../FixtureAutoImportNames/SomeShort.php | 2 +- .../Rector/Array_/ArrayToFirstClassCallableRector.php | 2 +- src/PhpParser/Node/FileNode.php | 2 +- structarmed.php | 8 ++++++++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 07fd8a1b637..627b8cffe96 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()); From 2d0e62bd3a7d785e719c381e57fcb529fa65a423 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 24 Jul 2026 06:58:03 +0700 Subject: [PATCH 2/3] skip not needed change --- .../Name/RenameClassRector/FixtureAutoImportNames/SomeShort.php | 2 +- structarmed.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rules-tests/Renaming/Rector/Name/RenameClassRector/FixtureAutoImportNames/SomeShort.php b/rules-tests/Renaming/Rector/Name/RenameClassRector/FixtureAutoImportNames/SomeShort.php index 81c22f6cfc2..a9bbd6152d3 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; -final class SomeShort +class SomeShort { } diff --git a/structarmed.php b/structarmed.php index 4a668b365fc..08a3c49b344 100644 --- a/structarmed.php +++ b/structarmed.php @@ -26,6 +26,7 @@ ], 'source.must_be_final' => [ '*/Source/*', + '*/Source/*', ], ]) ->withPreset(Preset::PSR4()); From 1ccbbd783fb28d75f5b5d4aed83c8f80b0d537d6 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 24 Jul 2026 06:58:19 +0700 Subject: [PATCH 3/3] skip not needed change --- structarmed.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/structarmed.php b/structarmed.php index 08a3c49b344..a73ba21f4de 100644 --- a/structarmed.php +++ b/structarmed.php @@ -26,7 +26,7 @@ ], 'source.must_be_final' => [ '*/Source/*', - '*/Source/*', + '*/Fixture*', ], ]) ->withPreset(Preset::PSR4());