Ir al contenido

Too many parameters (ARCH7181)

Esta página aún no está disponible en tu idioma.

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.

<?php
function 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);
}
<?php
function createUser(Name $name, string $email, Address $address): User
{
return new User($name, $email, $address);
}

Group related parameters into a single value object (parameter object).