Skip to content

Fix false positive UselessCast for (void) cast on #[\NoDiscard] calls#313

Merged
ondrejmirtes merged 1 commit into2.0.xfrom
claude/fix-phpstan-14565-KK5w3
May 2, 2026
Merged

Fix false positive UselessCast for (void) cast on #[\NoDiscard] calls#313
ondrejmirtes merged 1 commit into2.0.xfrom
claude/fix-phpstan-14565-KK5w3

Conversation

@ondrejmirtes
Copy link
Copy Markdown
Member

@ondrejmirtes ondrejmirtes commented May 2, 2026

The PHP 8.5 (void) cast exists specifically to discard a value and
silence #[\NoDiscard] warnings; it is never useless by definition.

Closes phpstan/phpstan#14565

…alls

The PHP 8.5 `(void)` cast exists specifically to discard a value and
silence `#[\NoDiscard]` warnings; it is never useless by definition.

phpstan/phpstan#14565
@ondrejmirtes ondrejmirtes merged commit 9b000a5 into 2.0.x May 2, 2026
43 checks passed
@ondrejmirtes ondrejmirtes deleted the claude/fix-phpstan-14565-KK5w3 branch May 2, 2026 06:54
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.

Void-casting #[\NoDiscard] causes false positive on 8.5+

2 participants