Skip to content

fix: skip property_get for callable expressions during hover#1119

Open
DrSAS wants to merge 1 commit intoxdebug:mainfrom
DrSAS:fix/hover-method-call-property-get-1118
Open

fix: skip property_get for callable expressions during hover#1119
DrSAS wants to merge 1 commit intoxdebug:mainfrom
DrSAS:fix/hover-method-call-property-get-1118

Conversation

@DrSAS
Copy link
Copy Markdown

@DrSAS DrSAS commented Apr 12, 2026

Fixes #1118

Problem

When hovering over a method call like $this->compute($value) during a breakpoint, the adapter sends a property_get command. This triggers __get() on the server side, producing unwanted PHP Notices before the TypeScript catch block can intervene.

Solution

Added isHoverOnCallable() which reads the source line and checks if the hovered expression is immediately followed by parentheses. If so, the evaluate request is rejected early — no property_get is sent.

Changes

  • EvaluateArgsWithSource interface for typed access to source
  • isHoverOnCallable() private helper on PhpDebugSession
  • Early return guard in evaluateRequest for hover context

Tested manually

Scenario Result
Hover on method call $this->compute(...) No PHP Notice, no side-effect
Hover on property $this->cache Shows value (unchanged)
Hover on variable $model Shows value (unchanged)
Hover on method name without () Falls back to property_get (unchanged)
Hover on method call via remote container (vscode-remote://) No PHP Notice, no side-effect

@DrSAS DrSAS force-pushed the fix/hover-method-call-property-get-1118 branch from 7c15b84 to bf5a07f Compare April 12, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hover on method call sends property_get instead of recognizing it as a method

1 participant