From 904deaecab4be31e1eebaf55cd495e6b250e8c58 Mon Sep 17 00:00:00 2001 From: nikhil2004 Date: Wed, 23 Sep 2026 14:21:14 +0530 Subject: [PATCH] fix(php): prevent non-route closures from adopting parent route names (cherry picked from commit 9d592e6996f72c21c9d088443bdb485a7605c5d3) --- graphify/extractors/engine.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/graphify/extractors/engine.py b/graphify/extractors/engine.py index 88c25a143..cf5ae1f44 100644 --- a/graphify/extractors/engine.py +++ b/graphify/extractors/engine.py @@ -3512,6 +3512,10 @@ def _php_get_route_name(closure_node, src: bytes) -> str | None: continue elif curr.type in ("anonymous_function", "arrow_function"): + if verb is None: + # We are a non-route closure nested inside another closure. + # Don't adopt the outer closure's route. + return None # Jump across the closure boundary to its containing argument curr = curr.parent continue