View Issue Details

IDProjectCategoryView StatusLast Update
0000928XMB1New Featurespublic2026-08-20 15:08
Reportermiqrogroove Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Target Version1.12.00 
Summary0000928: Implement the NoDiscard Attribute
DescriptionPHP 8.5 introduced a "NoDiscard" attribute that can emit warnings if a function or method's return value is never used. Some limited instances of this might be good in the long run.
Additional InformationThe attribute is intended to be used on functions where the user of the function is likely to forget using the return value by accident and where not using the return value will result in buggy behavior that is hard to detect during testing.

The above example of the bulk_process() function is a good use-case. It is a function with side-effects and it will correctly process all the items in the vast majority of the cases, making it easy to miss the failure case when testing the functionality.

str_contains() on the other hand is likely to be a bad use-case. It is unlikely for a developer to call str_contains() and not do anything with the result, as the function does not result in side-effects (other than implicitly casting the arguments to strings). If the developer forgets to use the return value anyways, it will just result in unnecessary processing without any further negative effects. The same reasoning applies to most “pure” functions.
TagsNo tags attached.
MySQL Version
PHP Version
Web Server
Browser
Flags
Original Reporter
SVN Revision
Git Commit

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2026-08-20 14:48 miqrogroove New Issue
2026-08-20 15:08 miqrogroove Additional Information Updated