Skip to content

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

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

[DeadCode] Skip with assign to call with target has #[NoDiscard] attribute on RemoveUnusedVariableAssignRector#7950
TomasVotruba merged 6 commits intomainfrom
skip-no-discard

Conversation

@samsonasik
Copy link
Copy Markdown
Member

@samsonasik samsonasik commented Apr 2, 2026

@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?

Copy link
Copy Markdown
Member Author

@samsonasik samsonasik Apr 2, 2026

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

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.

2 participants