Skip to content

fix(rename): handle variables in dynamic property selectors - #174

Merged
AJenbo merged 1 commit into
PHPantom-dev:mainfrom
calebdw:calebdw/push-tmorwosozptt
Jul 4, 2026
Merged

fix(rename): handle variables in dynamic property selectors#174
AJenbo merged 1 commit into
PHPantom-dev:mainfrom
calebdw:calebdw/push-tmorwosozptt

Conversation

@calebdw

@calebdw calebdw commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Dynamic property selectors like $message->{$attribute} were only partially walked. The scope collector skipped selector expressions when tracking local variable reads, which caused false unused_variable diagnostics for the selector variable.

The symbol map extractor also ignored non-identifier property selectors, so find-references and rename missed variable occurrences inside dynamic property accesses. Renaming $attribute updated plain variable uses but not the selector inside $message->{$attribute}.

Walk selector expressions during scope collection and emit variable symbol spans for dynamic property selectors in the symbol map. Add regression tests covering unused-variable diagnostics, references, and rename behavior for this pattern.

@calebdw
calebdw force-pushed the calebdw/push-tmorwosozptt branch from 8ad94da to 2d89408 Compare June 26, 2026 21:42
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 73.95833% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/scope_collector/mod.rs 30.00% 14 Missing ⚠️
src/symbol_map/extraction.rs 83.07% 11 Missing ⚠️

📢 Thoughts on this report? Let us know!

@calebdw
calebdw force-pushed the calebdw/push-tmorwosozptt branch from 2d89408 to 85ddd6b Compare July 3, 2026 17:52
Dynamic property selectors like `$message->{$attribute}` were only
partially
walked. The scope collector skipped selector expressions when tracking
local
variable reads, which caused false `unused_variable` diagnostics for the
selector variable.

The symbol map extractor also ignored non-identifier property selectors,
so
find-references and rename missed variable occurrences inside dynamic
property
accesses. Renaming `$attribute` updated plain variable uses but not the
selector inside `$message->{$attribute}`.

Walk selector expressions during scope collection and emit variable
symbol
spans for dynamic property selectors in the symbol map. Add regression
tests
covering unused-variable diagnostics, references, and rename behavior
for this
pattern.

Signed-off-by: Anders Jenbo <anders@jenbo.dk>
@AJenbo
AJenbo force-pushed the calebdw/push-tmorwosozptt branch from 85ddd6b to cb8f842 Compare July 4, 2026 01:29
@AJenbo
AJenbo enabled auto-merge (rebase) July 4, 2026 01:29
@AJenbo
AJenbo disabled auto-merge July 4, 2026 01:30
@AJenbo
AJenbo merged commit d04de94 into PHPantom-dev:main Jul 4, 2026
6 of 7 checks passed
@calebdw
calebdw deleted the calebdw/push-tmorwosozptt branch July 4, 2026 01:32
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.

3 participants