Skip to content

Usage of "Constructor Promotion" for PHP >= 8.0.2 #17204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2193,12 +2193,8 @@ the :class:`Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface` class

class SomeService
{
private $router;

public function __construct(UrlGeneratorInterface $router)
{
$this->router = $router;
}
public function __construct(private UrlGeneratorInterface $router)
{}
Comment on lines +2196 to +2197
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure which code style Symfony uses, but we should use the same

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


public function someMethod()
{
Expand Down Expand Up @@ -2312,13 +2308,9 @@ Now you'll get the expected results when generating URLs in your commands::

class SomeCommand extends Command
{
private $router;

public function __construct(RouterInterface $router)
public function __construct(private RouterInterface $router)
{
parent::__construct();

$this->router = $router;
}

protected function execute(InputInterface $input, OutputInterface $output): int
Expand Down