Skip to content

PHP: every use Namespace\* resolves to the same file #1186

Open

Description

@softronicve

Opened the graph UI on a Laravel + Flutter repo and one file showed up as a massive hub, with most of the codebase apparently importing it. It's a small model class in a corner feature. Four files actually use it. The graph had 924 incoming IMPORTS.

Every use App\Models\* in the project resolves to that one file. Checking local_name on the incoming edges makes it obvious:

User      193
Agency    114
Property   83
Client     77
Agent      69

None of those are the class the node belongs to. It's the entire namespace collapsed onto whichever file the indexer reached first — not alphabetically first, I checked that.

Same in my other two PHP namespaces: 147 edges where 3 are real, and 56 where 1 is real.

That's 31% of every IMPORTS edge in the project sitting on one node, so import fan-in is meaningless for PHP. It's worse in the UI than in queries, because a fabricated hub looks exactly like a genuine one.

Possibly the same root cause: 451 CALLS edges connect files in different languages. PHP→Dart 250, PHP→JS 147, Dart→PHP 54. No FFI or codegen involved, these can't exist. They're all generic callee names — validated, filter, get, load — matched on bare name against the whole index. Same reason one policy method ends up with 587 incoming calls: that's every Eloquent ->create() in the repo landing on it.

451/6385 is a floor on the CALLS error rate, since it only counts what's provable by language mismatch.

confidence does rescue CALLS, unlike IMPORTS. I spot-checked 17 edges at >= 0.9 against the source and all 17 were right, with correct line numbers. The junk is all down at 0.09–0.38. The catch is that the useful cross-file PHP calls are at 0.38 as well, mixed roughly half and half with fabrications, so there's no threshold that keeps controller→service edges and drops the invented ones. At >= 0.9 PHP is just intra-file $this-> calls. JS resolution is solid though, 8/8 correct at 0.95 via import_map.

For the unresolved case I'd much rather get no edge than a confident wrong one. And refusing to resolve calls across language boundaries would drop those 451 for free.

0.9.0, linux x86-64, indexed with mode: full. ~1050 source files, 11003 nodes / 29896 edges. Happy to run queries against this index if it helps.

Activity

  1. added
    cypherCypher query language parser/executor bugs
    ux/behaviorDisplay bugs, docs, adoption UX
    on Jul 20, 2026
  2. changed the title [-]PHP: every `use Namespace\*` import collapses onto one arbitrary file — 31% of IMPORTS edges land on a single node[/-] [+]PHP: every `use Namespace\*` resolves to the same file[/+] on Jul 20, 2026
  3. removed
    cypherCypher query language parser/executor bugs
    on Jul 22, 2026
  4. added this to the 0.9.1-rc milestone on Jul 22, 2026
  5. added
    bugSomething isn't working
    priority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.
    on Jul 22, 2026
  6. DeusData commented on Jul 22, 2026

    @DeusData
    Owner

    Thanks for quantifying both the fabricated PHP IMPORTS hub and the provably impossible cross-language CALLS edges. This is a high-priority 0.9.1-rc graph-correctness bug under #594. The acceptance bar is fail-closed resolution: wildcard imports must resolve per symbol rather than per namespace bucket, and generic bare-name fallback must not cross unrelated language registries. No additional reporter action is needed right now.

  7. DeusData commented on Sep 26, 2026

    @DeusData
    Owner

    Thank you, @softronicve, for quantifying this so carefully! We reproduced the IMPORTS collapse on current main. With PSR-4 autoloading, use App\Models\Agency; still resolves to User.php, the first file in the namespace directory. That keeps this open as a real graph-correctness bug. The cross-language CALLS half, where a name-only match binds a call to another language's symbol, is being worked on separately.

  8. DeusData commented on Oct 19, 2026

    @DeusData
    Owner

    Thank you for the quantified PHP import and call-edge examples. The last reproduction still showed the PSR-4 IMPORTS collapse; I have no new resolution to report. The cross-language CALLS case remains distinct, so improvement there should not be taken as confirmation that the import issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.ux/behaviorDisplay bugs, docs, adoption UX

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions