From 7e91e94e40da8de235e18f6322ae16f7b61e7ef4 Mon Sep 17 00:00:00 2001 From: Carlos Granados Date: Sat, 17 Aug 2024 21:04:03 +0200 Subject: [PATCH] Patch needed for https://github.com/rectorphp/rector-src/pull/6232 --- ...rser-lib-phpparser-nodetraverser-php.patch | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 patches/nikic-php-parser-lib-phpparser-nodetraverser-php.patch diff --git a/patches/nikic-php-parser-lib-phpparser-nodetraverser-php.patch b/patches/nikic-php-parser-lib-phpparser-nodetraverser-php.patch new file mode 100644 index 0000000..776f9df --- /dev/null +++ b/patches/nikic-php-parser-lib-phpparser-nodetraverser-php.patch @@ -0,0 +1,55 @@ +--- /dev/null ++++ ../lib/PhpParser/NodeTraverser.php +@@ -119,7 +119,8 @@ + $traverseChildren = true; + $breakVisitorIndex = null; + +- foreach ($this->visitors as $visitorIndex => $visitor) { ++ $visitors = $this->getVisitorsForNode($subNode); ++ foreach ($visitors as $visitorIndex => $visitor) { + $return = $visitor->enterNode($subNode); + if (null !== $return) { + if ($return instanceof Node) { +@@ -149,7 +150,7 @@ + } + } + +- foreach ($this->visitors as $visitorIndex => $visitor) { ++ foreach ($visitors as $visitorIndex => $visitor) { + $return = $visitor->leaveNode($subNode); + + if (null !== $return) { +@@ -196,7 +197,8 @@ + $traverseChildren = true; + $breakVisitorIndex = null; + +- foreach ($this->visitors as $visitorIndex => $visitor) { ++ $visitors = $this->getVisitorsForNode($node); ++ foreach ($visitors as $visitorIndex => $visitor) { + $return = $visitor->enterNode($node); + if (null !== $return) { + if ($return instanceof Node) { +@@ -226,7 +228,7 @@ + } + } + +- foreach ($this->visitors as $visitorIndex => $visitor) { ++ foreach ($visitors as $visitorIndex => $visitor) { + $return = $visitor->leaveNode($node); + + if (null !== $return) { +@@ -270,6 +272,14 @@ + } + + return $nodes; ++ } ++ ++ /** ++ * @return NodeVisitor[] ++ */ ++ public function getVisitorsForNode(Node $node) ++ { ++ return $this->visitors; + } + + private function ensureReplacementReasonable($old, $new) {