1.2.690. Methods Without Return¶
List of all the functions, closures, methods that have no explicit return.
Functions with the void
or never
return types, are omitted.
<?php
// With return null : Explicitly not returning
function withExplicitReturn($a = 1) {
$a++;
return null;
}
// Without indication
function withoutExplicitReturn($a = 1) {
$a++;
}
// With return type void : Explicitly not returning
function withExplicitReturnType($a = 1) : void {
$a++;
}
?>
See also return.
1.2.690.1. Connex PHP features¶
1.2.690.1.1. Suggestions¶
Add the returntype ‘void’ to make this explicit behavior
1.2.690.1.2. Specs¶
Short name |
Functions/WithoutReturn |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |