diff --git a/routing.rst b/routing.rst index 2deee8bc920..b8e03422ec1 100644 --- a/routing.rst +++ b/routing.rst @@ -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) + {} public function someMethod() { @@ -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 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy