From 4393c3d54bca972a8bd12057c9939560fd378a18 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 7 Dec 2025 00:22:37 +0100 Subject: [PATCH] [internal] Mark beforeTraverse() in AbstractRector as @final to prevent override and miss-use --- phpstan.neon | 5 +++++ src/Rector/AbstractRector.php | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/phpstan.neon b/phpstan.neon index 8321117bd09..0a2f7a73fa0 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -408,3 +408,8 @@ parameters: - identifier: rector.noOnlyNullReturnInRefactor path: rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php + + # handle next with FileNode + - + identifier: method.parentMethodFinalByPhpDoc + path: rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php diff --git a/src/Rector/AbstractRector.php b/src/Rector/AbstractRector.php index abcc15b6662..6d0e317e12d 100644 --- a/src/Rector/AbstractRector.php +++ b/src/Rector/AbstractRector.php @@ -106,6 +106,10 @@ public function autowire( } /** + * @final Avoid override to prevent unintended side-effects. Use enterNode() or @see \Rector\Contract\PhpParser\DecoratingNodeVisitorInterface instead. + * + * @internal + * * @return Node[]|null */ public function beforeTraverse(array $nodes): ?array