method.parameters-linebreakfixable
Break parameters into multiple lines or group them into a single line based on the position of the first parameter.
Examples
- Examples of correct code for this rule using default options
Parameters in one line
php
<?php
function test($a, $b, $c ) {};
class CustomerDTO {
public function __construct(public string $name, public string $email, public DateTimeImmutable $birth_date) {}
}
class Whatever {
public function __construct() {
$this->doAnything('true', false )->anotherMethod('hello', 'there');
}
}
new CustomerDTO('hello', 'there', new DateTimeImmutable());
Parameters on multiple lines
php
<?php
function test(
$a,
$b,
$c
) {};
class CustomerDTO {
public function __construct(
public string $name,
public string $email,
public DateTimeImmutable $birth_date
) {}
}
class Whatever {
public function __construct() {
$this->doAnything(
'true',
false
)->anotherMethod(
'hello',
'there'
);
}
}
new CustomerDTO(
'hello',
'there',
new DateTimeImmutable()
);
- Examples of incorrect code for this rule using default options
Parameters on mixed lines
php
<?php
function test(
$a, $b,
$c
) {};
class CustomerDTO {
public function __construct( public string $name,
public string $email,
public DateTimeImmutable $birth_date
) {}
}
class Whatever {
public function __construct() {
$this->doAnything('true',
false
)->anotherMethod(
'hello', 'there'
);
}
}
new CustomerDTO('hello', 'there',
new DateTimeImmutable()
);