1.2.709. Missing Type In Definition¶
This rule reports any missing typehints, on parameters, return value, property or class constants. It is recommended to add types to all possible structures to make the type system more efficient.
__construct() and __destruct() should not use typehints, and are omitted.
Class constants are typed starting with PHP 8.3
<?php
// No type on return type
// n type on parameter
function missing($parameter) {
/// code
}
?>
1.2.709.1. Connex PHP features¶
1.2.709.1.1. Suggestions¶
Add a useful typehint
Add the mixed typehint
1.2.709.1.2. Specs¶
Short name |
Typehints/MissingTypehints |
Rulesets |
|
Exakat since |
2.3.6 |
PHP Version |
With PHP 7.0 and more recent |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |