Skip to content

Add constructor reference support for attributes#155

Merged
AJenbo merged 2 commits into
PHPantom-dev:mainfrom
RemcoSmitsDev:fix-find-references-for-attributes
Jun 20, 2026
Merged

Add constructor reference support for attributes#155
AJenbo merged 2 commits into
PHPantom-dev:mainfrom
RemcoSmitsDev:fix-find-references-for-attributes

Conversation

@RemcoSmitsDev

Copy link
Copy Markdown
Contributor

Hey, while I was trying out this LSP again, I noticed that find all references for a constructor didn't work in combination with attributes. So this PR fixes this by adding a new ClassRefContext option called Attribute, this allows us to do some additional checks for getting all the right references in the case of class attributes.

Here is a video of how works now, vs how it was before (it didn't find any references at all) because the class used in my example the symfony Group class attribute is never normally instantiated using new Group.

Note for the reviewer: A part of this change was assistet with AI because I don't know the code that good.
So let me know if you want me to make any changes!

Screen.Recording.2026-06-13.at.20.24.52.mov

@codecov-commenter

codecov-commenter commented Jun 13, 2026

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 89.10256% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/references/mod.rs 89.47% 16 Missing ⚠️
src/diagnostics/invalid_class_kind.rs 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

delegation calls (`parent::__construct`, etc.), and attribute usages.

Signed-off-by: Anders Jenbo <anders@jenbo.dk>
@AJenbo AJenbo enabled auto-merge (squash) June 20, 2026 13:05
@AJenbo AJenbo disabled auto-merge June 20, 2026 13:12
@AJenbo AJenbo merged commit aaa9092 into PHPantom-dev:main Jun 20, 2026
5 of 7 checks passed
@AJenbo

AJenbo commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks for working on this

@RemcoSmitsDev RemcoSmitsDev deleted the fix-find-references-for-attributes branch June 20, 2026 13: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.

3 participants