Closed
Description
I am referring to this:
symfony-docs/contributing/code/standards.rst
Lines 182 to 183 in dc9a534
Now that we have constructor property promotion in PHP 8, do you still feel like this rule makes sense? Especially constructors can become quite long, e.g.:
class Request
{
public function __construct(public array $query = [], public array $request = [], public array $attributes = [], public array $cookies = [], public array $files = [], public array $server = [], protected string|object|false|null $content = null)
{
$this->initialize($query, $request, $attributes, $cookies, $files, $server, $content);
}
}
Compared to:
class Request
{
public function __construct(
public array $query = [],
public array $request = [],
public array $attributes = [],
public array $cookies = [],
public array $files = [],
public array $server = [],
protected string|object|false|null $content = null
) {
$this->initialize($query, $request, $attributes, $cookies, $files, $server, $content);
}
}
I realize that you are not promoting constructor property promotion yet (as explained in #16087) and I also realize that nobody has to adopt the Symfony coding style if they don‘t agree with it. However, removing that rule does not mean that anyone (including Symfony) has to change their code, so I figured we could at least discuss it.
What do you think?