diff --git a/graphify/extract.py b/graphify/extract.py
index d54b841d9..29692e9ed 100644
--- a/graphify/extract.py
+++ b/graphify/extract.py
@@ -2546,9 +2546,72 @@ def extract_scala(path: Path) -> dict:
return _extract_generic(path, _SCALA_CONFIG)
+_PHP_SCRIPT_RE = re.compile(
+ r"",
+ re.IGNORECASE,
+)
+
+
+def _php_mask_to_script_blocks(src: str) -> tuple[str, bool]:
+ """Blank everything outside inline ```` with no body masks to an empty region,
+ which parses as empty JS and contributes nothing — no special-casing needed.
+ Returns ``(masked_source, had_script)``; the caller skips the JS pass
+ entirely when ``had_script`` is False.
+ """
+ def _blank(s: str) -> str:
+ return re.sub(r"[^\r\n]", " ", s)
+
+ out: list[str] = []
+ pos = 0
+ had_script = False
+ for m in _PHP_SCRIPT_RE.finditer(src):
+ had_script = True
+ out.append(_blank(src[pos:m.start(1)])) # everything up to and including and any trailing part of the match
+ pos = m.end()
+ if not had_script:
+ return src, False
+ out.append(_blank(src[pos:]))
+ return "".join(out), True
+
+
def extract_php(path: Path) -> dict:
- """Extract classes, functions, methods, namespace uses, and calls from a .php file."""
- return _extract_generic(path, _PHP_CONFIG)
+ """Extract classes, functions, methods, namespace uses, and calls from a .php file.
+
+ Also parses any inline ``