1.2.836. 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.836.2. Connex PHP features¶
1.2.836.2.1. Suggestions¶
Removes the reference operator from the function definition
1.2.836.2.2. Specs¶
Short name |
Functions/NoReferencedVoid |
Rulesets |
All, Analyze, Changed Behavior, CompatibilityPHP81, Deprecated |
Exakat since |
2.2.4 |
Severity |
Minor |
Time To Fix |
Instant (5 mins) |
Precision |
Very high |
Available in |