From cab67f9083576ad4cae55ad9bef010b885e4a3c0 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 2 May 2026 23:24:43 +0200 Subject: [PATCH 1/3] remove php-parser patches, as stmts aware deprecated for a while --- composer.json | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/composer.json b/composer.json index 32935ef8124..14f0f766db6 100644 --- a/composer.json +++ b/composer.json @@ -121,23 +121,6 @@ "patches": { "illuminate/container": [ "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/illuminate-container-container-php.patch" - ], - "nikic/php-parser": [ - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-expr-closure-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-finally-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-function-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-do-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-catch-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-trycatch-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-for-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-classmethod-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-else-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-while-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-foreach-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-if-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-case-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-elseif-php.patch", - "https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-namespace-php.patch" ] }, "composer-exit-on-patch-failure": true, From 28418a2a7db8cf9f37cb79cbca0679a6386bddcd Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 2 May 2026 23:29:31 +0200 Subject: [PATCH 2/3] remove from FielWithoutNamespace as other nodes --- src/PhpParser/Node/CustomNode/FileWithoutNamespace.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/PhpParser/Node/CustomNode/FileWithoutNamespace.php b/src/PhpParser/Node/CustomNode/FileWithoutNamespace.php index da4c17f529f..5f256257607 100644 --- a/src/PhpParser/Node/CustomNode/FileWithoutNamespace.php +++ b/src/PhpParser/Node/CustomNode/FileWithoutNamespace.php @@ -5,7 +5,6 @@ namespace Rector\PhpParser\Node\CustomNode; use Override; -use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\PhpParser\Node\FileNode; /** @@ -14,7 +13,7 @@ * * Inspired by https://github.com/phpstan/phpstan-src/commit/ed81c3ad0b9877e6122c79b4afda9d10f3994092 */ -final class FileWithoutNamespace extends FileNode implements StmtsAwareInterface +final class FileWithoutNamespace extends FileNode { #[Override] public function getType(): string From 6412efbf0b8707bef3f1ce678f83e78bbf728699 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 2 May 2026 23:38:05 +0200 Subject: [PATCH 3/3] remove deprecated StmtsAwareInterface --- build/build-preload.php | 7 +------ preload-split-package.php | 1 - preload.php | 1 - .../PhpParser/Node/StmtsAwareInterface.php | 18 ------------------ src/Reporting/DeprecatedRulesReporter.php | 16 ---------------- 5 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 src/Contract/PhpParser/Node/StmtsAwareInterface.php diff --git a/build/build-preload.php b/build/build-preload.php index c7c62f96787..e35185370f8 100755 --- a/build/build-preload.php +++ b/build/build-preload.php @@ -355,12 +355,7 @@ private function findPhpParserFilesAndSortThem(string $vendorDir): array } } - $fileInfos = array_values($fileInfos); - - $stmtsAwareInterface = new SplFileInfo(__DIR__ . '/../src/Contract/PhpParser/Node/StmtsAwareInterface.php'); - array_splice($fileInfos, 1, 0, [$stmtsAwareInterface]); - - return $fileInfos; + return array_values($fileInfos); } /** diff --git a/preload-split-package.php b/preload-split-package.php index da953d5a7e5..f0ca37624c2 100644 --- a/preload-split-package.php +++ b/preload-split-package.php @@ -26,7 +26,6 @@ function isPHPStanTestPreloaded(): bool } require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/Node.php'; -require_once __DIR__ . '/src/Contract/PhpParser/Node/StmtsAwareInterface.php'; require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php'; require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/Node/Expr.php'; require_once __DIR__ . '/../../../vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php'; diff --git a/preload.php b/preload.php index cecb0b90b4c..027b441e3b9 100644 --- a/preload.php +++ b/preload.php @@ -26,7 +26,6 @@ function isPHPStanTestPreloaded(): bool } require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node.php'; -require_once __DIR__ . '/src/Contract/PhpParser/Node/StmtsAwareInterface.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php'; diff --git a/src/Contract/PhpParser/Node/StmtsAwareInterface.php b/src/Contract/PhpParser/Node/StmtsAwareInterface.php deleted file mode 100644 index 646675a82a6..00000000000 --- a/src/Contract/PhpParser/Node/StmtsAwareInterface.php +++ /dev/null @@ -1,18 +0,0 @@ -getNodeTypes())) { - continue; - } - // already reported, skip if (in_array($rector::class, $reportedClasses, true)) { continue; } $reportedClasses[] = $rector::class; - - $this->symfonyStyle->warning(sprintf( - 'Rector rule "%s" uses StmtsAwareInterface that is now deprecated.%sUse "%s::%s" instead.%sSee %s for more', - $rector::class, - PHP_EOL, - NodeGroup::class, - 'STMTS_AWARE', - PHP_EOL . PHP_EOL, - 'https://github.com/rectorphp/rector-src/pull/7679' - )); } }