1.2.830. No Referenced Void¶
There is no point returning a reference with a void type. This is now reported as deprecated in PHP 8.1.
<?php
function &test(): void {}
?>
See also PHP RFC: Deprecations for PHP 8.1.
1.2.830.1. Suggestions¶
Removes the reference operator from the function definition
1.2.830.2. Specs¶
Short name |
Functions/NoReferencedVoid |
Rulesets |
|
Exakat since |
2.2.4 |
Severity |
Minor |
Time To Fix |
Instant (5 mins) |
Precision |
Very high |
Features |
void, reference |
Available in |