-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
actionableClear and specific issues ready for anyone to take them.Clear and specific issues ready for anyone to take them.good first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)hasPRA Pull Request has already been submitted for this issue.A Pull Request has already been submitted for this issue.
Description
I am referring to this:
symfony-docs/contributing/code/standards.rst
Lines 182 to 183 in dc9a534
* Declare all the arguments on the same line as the method/function name, no | |
matter how many arguments there are; |
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?
fritzmg, Toflar, m-vo, ausi, 94noni and 2 moreToflar
Metadata
Metadata
Assignees
Labels
actionableClear and specific issues ready for anyone to take them.Clear and specific issues ready for anyone to take them.good first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)hasPRA Pull Request has already been submitted for this issue.A Pull Request has already been submitted for this issue.