Missing type declaration (ARCH7193)
Ce contenu n’est pas encore disponible dans votre langue.
Key php.quality.missing-type-declaration · Severity info · Category quality
Public APIs without type declarations leave expected input and output ambiguous and weaken static analysis and IDE support. Add parameter and return types.
Incorrect
Section titled “Incorrect”<?phpfunction totalPrice($items){ return array_sum(array_column($items, 'price'));}Correct
Section titled “Correct”<?phpfunction totalPrice(array $items): float{ return array_sum(array_column($items, 'price'));}Add parameter and return type declarations to public functions and methods.