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/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..a73ba21f4de 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,9 @@ // simulate under phpstan.phar __DIR__ . '/rules-tests/Php71/Rector/FuncCall/RemoveExtraParametersRector/Source/phpstan.phar', ], + 'source.must_be_final' => [ + '*/Source/*', + '*/Fixture*', + ], ]) ->withPreset(Preset::PSR4());