Skip to content

[Bug]: PHP member calls dropped in remapped files, through inherited methods, and on repeat call sites #5362

Open

Description

@livingforelvis

Pre-flight checks

  • I have checked the Troubleshooting section in the README

What happened?

On PHP, _resolve_php_member_calls drops calls whose target is plain from the source:

  • Remapped extensions: a file mapped to PHP through .graphifyrc (language.inc=php) gets no Cls::m(), self::m() or parent::m() edges. The resolver checks the literal .php suffix (extract.py, endswith(".php")), while the extractor registry honours the mapping.
  • $this->m(): the receiver this has no branch. It is looked up in the annotation type table, missing from it, and skipped.
  • Inherited methods: the method lookup checks only the named class. A self::m(), $this->m() or Cls::m() whose m is declared in a base class gets no edge, and parent::m() reaches one level only.
  • Repeat call sites: a second call to the same method from the same caller is dropped. The resolver keeps one edge per caller and callee (existing_pairs), so the second line never reaches the build's also_seen ([Feature]: don't erase weaker-confidence evidence when edges or paths merge #4881). Separately, once any C++ header member merges with its .cc definition, _merge_decl_def_classes dedups every edge in the corpus by (source, target, relation, context), which drops repeat call sites in any language.

Expected:

  • one calls edge per call site;
  • the method found on the nearest class up the inherits chain, with a tie on that level binding nothing, as the Java resolver does.

Steps to reproduce

mkdir src && cd src
printf 'language.inc=php\n' > .graphifyrc
cat > Base.inc <<'EOF'
<?php
class Base {
    public function helper() { return 1; }
    public static function setup() { return 0; }
}
EOF
cat > Middle.inc <<'EOF'
<?php
class Middle extends Base {
}
EOF
cat > Child.inc <<'EOF'
<?php
class Child extends Middle {
    public function run() {
        $a = $this->helper();
        $b = $this->helper();
        return $a + $b;
    }
    public function boot() { return parent::setup(); }
    public static function make() { return self::setup(); }
}
EOF
# extract(...) on the three .inc files with root=src, then list the `calls` edges

Error output or graph output

  language overrides (.graphifyrc): .inc -> .php
  AST cache: 0/3 files served from cache (0%); 3 to extract
calls edges: 0

Expected four edges:

  • .run() -> .helper() at L4
  • .run() -> .helper() at L5
  • .boot() -> .setup() at L8
  • .make() -> .setup() at L9

Graphify version

0.9.113 (v8 at f51d46c)

Operating System

macOS

Python Version

3.14

I have a fix with tests ready and can open a PR.

Activity

  1. github-actions commented on Nov 20, 2026

    @github-actions

    Thanks for opening this issue, @livingforelvis. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions