Skip to content

[DeadCode] Skip with assign to call with target has #[NoDiscard] attribute on RemoveUnusedVariableAssignRector - #7950

Merged
TomasVotruba merged 6 commits into
mainfrom
skip-no-discard
Apr 2, 2026
Merged

TomasVotruba merged 6 commits into
mainfrom
skip-no-discard

Conversation

@samsonasik

@samsonasik samsonasik commented Apr 2, 2026

Copy link
Copy Markdown
Member

@samsonasik samsonasik changed the title [DeadCode] Skip with assign to call with target has #[NoDiscard] attribute [DeadCode] Skip with assign to call with target has #[NoDiscard] attribute on RemoveUnusedVariableAssignRector Apr 2, 2026
@samsonasik
samsonasik requested a review from TomasVotruba April 2, 2026 14:51
@samsonasik

Copy link
Copy Markdown
Member Author

@TomasVotruba ready 👍

Comment on lines +276 to +280
if ($assign->expr instanceof FuncCall
|| $assign->expr instanceof StaticCall
|| $assign->expr instanceof MethodCall
|| $assign->expr instanceof New_
|| $assign->expr instanceof NullsafeMethodCall) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about instanceof CallLike?

@samsonasik samsonasik Apr 2, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That cause phpstan notice, see

https://github.com/rectorphp/rector-src/actions/runs/23905789349/job/69714124150#step:5:19

use the required instance fix it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see

@TomasVotruba
TomasVotruba merged commit b1899f4 into main Apr 2, 2026
60 checks passed
@TomasVotruba
TomasVotruba deleted the skip-no-discard branch April 2, 2026 16:19
@TomasVotruba

Copy link
Copy Markdown
Member

Thank you

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants