Too many parameters (ARCH7181)
Ce contenu n’est pas encore disponible dans votre langue.
Key php.quality.too-many-parameters · Severity warning · Category quality
A long parameter list makes call sites error-prone and signals the unit knows too much. Group related parameters into a parameter object.
Incorrect
Section titled “Incorrect”<?phpfunction createUser( string $first, string $last, string $email, string $street, string $city, string $zip, string $country): User { return new User($first, $last, $email, $street, $city, $zip, $country);}Correct
Section titled “Correct”<?phpfunction createUser(Name $name, string $email, Address $address): User{ return new User($name, $email, $address);}Group related parameters into a single value object (parameter object).