Closed TomasVotruba closed 2 months ago
Symfony 6.3 introduced tiny improvement to use param and env directly as named argument of #[Attribute].
param
env
#[Attribute]
See https://symfony.com/blog/new-in-symfony-6-3-dependency-injection-improvements#new-options-for-autowire-attribute
Here we go :)
namespace App\Service; use Symfony\Component\DependencyInjection\Attribute\Autowire; class MessageGenerator { public function __construct( - #[Autowire('%kernel.debug%')] + #[Autowire(param: 'kernel.debug')] bool $debugMode, - #[Autowire('%env(SOME_ENV_VAR)%')] + #[Autowire(env: 'SOME_ENV_VAR')] string $senderName, ) { } }
Symfony 6.3 introduced tiny improvement to use
param
andenv
directly as named argument of#[Attribute]
.See https://symfony.com/blog/new-in-symfony-6-3-dependency-injection-improvements#new-options-for-autowire-attribute
Here we go :)