Skip to content

Add (void) casting syntax for PHP 8.5#5546

Merged
jordikroon merged 2 commits intophp:masterfrom
jordikroon:docs/void-cast
May 8, 2026
Merged

Add (void) casting syntax for PHP 8.5#5546
jordikroon merged 2 commits intophp:masterfrom
jordikroon:docs/void-cast

Conversation

@jordikroon
Copy link
Copy Markdown
Member

Added the (void) cast to indicate that not using a value is intentional. The (void) cast has no effect on the program's execution by itself, but it can be used to suppress warnings emitted by #[\NoDiscard] and possibly also diagnostics emitted by external IDEs or static analysis tools. RFC: https://wiki.php.net/rfc/marking_return_value_as_important

#5038 depends on this.

@jordikroon jordikroon requested a review from TimWolla May 7, 2026 21:33
Comment thread language/types/void.xml Outdated
Comment thread language/types/type-juggling.xml Outdated
@jordikroon jordikroon merged commit 50f76f2 into php:master May 8, 2026
2 checks passed
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