fix(parsers/php): resolve same-class methods that shadow a PHP builtin name - #140
Merged
Conversation
…n name _resolve_member_call ($this->) and _resolve_scoped_call (self::/static::/ parent::/Class::) ran `if self._is_builtin(method_name): return None` BEFORE the same-class method lookup, so a call to a method named like a PHP builtin (count/next/key — the Countable/Iterator/Serializable interface methods) was dropped from the call graph even though the class defines it. The missing edge survives into call_graph.json with no downstream rescue. Remove the two premature guards so $this->count()/self::count() route to the class-method resolver, which returns an id only when the method exists in the class index (real builtin calls with no matching own method still resolve to None below). The builtin filter is intentionally kept for bare func() and string callbacks, where an unqualified name binds the global PHP builtin. Mirrors the shadow-aware resolution already shipped in parsers/ruby. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
gadievron
marked this pull request as ready for review
July 10, 2026 18:17
gadievron
requested review from
dgeyshis,
shahar-davidson and
sounil
as code owners
July 10, 2026 18:17
…h_builder + re-anchor test) # Conflicts: # libs/openant-core/parsers/php/call_graph_builder.py # libs/openant-core/tests/parsers/php/test_call_graph_builder.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_resolve_member_call ($this->) and _resolve_scoped_call (self::/static::/
parent::/Class::) ran
if self._is_builtin(method_name): return NoneBEFOREthe same-class method lookup, so a call to a method named like a PHP builtin
(count/next/key — the Countable/Iterator/Serializable interface methods) was
dropped from the call graph even though the class defines it. The missing edge
survives into call_graph.json with no downstream rescue.
Remove the two premature guards so $this->count()/self::count() route to the
class-method resolver, which returns an id only when the method exists in the
class index (real builtin calls with no matching own method still resolve to
None below). The builtin filter is intentionally kept for bare func() and
string callbacks, where an unqualified name binds the global PHP builtin.
Mirrors the shadow-aware resolution already shipped in parsers/ruby.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Found by a deep reachability/call-graph validation of the parser corpus: the 2026 release fixed this bug class at some parser sites but left this sibling. Ships with a RED->GREEN regression test driving the real parser/detector pipeline (not a mock). One of a 9-PR series of independent, region-disjoint fixes; verified together (full suite green, no collisions).
🤖 Generated with Claude Code