Skip to content

Conversation

@sasezaki
Copy link

@sasezaki sasezaki commented Dec 14, 2025

@sasezaki sasezaki marked this pull request as ready for review December 14, 2025 06:36
}

?>
]]>
Copy link
Member

Choose a reason for hiding this comment

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

presumably you also have to call the function somewhere

]]>
</programlisting>
</example>
</section>
Copy link
Member

Choose a reason for hiding this comment

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

I suggest also documented somewhere (maybe just an example) for a $_ or similar being assigned so that the warning isn't shown without needing (void), which is only 8.5+, e.g.

Since attributes are designed to be backwards compatible, #[\NoDiscard] can also be added to functions and methods even when PHP 8.4 or below are supported, it just won't do anything. On PHP 8.5 and above a warning will be emitted if the result is unused. To suppress the warning without using (void), which is not supported before PHP 8.5, consider using a variable like $_.

$_ = some_command();

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