-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
[FrameworkBundle] append instead of replacing potentially non-existent named-arguments #53341
Conversation
xabbuh
commented
Jan 2, 2024
Q | A |
---|---|
Branch? | 5.4 |
Bug fix? | yes |
New feature? | no |
Deprecations? | no |
Issues | Fix #52998 (comment) |
License | MIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we stop using named args at all?
So those args are already wired in the default config files?
That's what we do now. Or do I misunderstand what you are asking for? |
The problem is that the bridges are wired via a factory that is declared via an abstract factory. see symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php Line 151 in 317c67b
As far as I have tested, if we remove the HttpClient and Dispatcher from the definition, they will not be injected in the constructor. |
I mean we revert the framework extension changes made in #52998 which were not necessary because of the |
If we revert the changes, the DI will generate this code (at least in 6.3): class getNotifier_TransportFactory_FakesmsService extends App_KernelDevDebugContainer
{
/**
* Gets the private 'notifier.transport_factory.fake-sms' shared service.
*
* @return \Symfony\Component\Notifier\Bridge\FakeSms\FakeSmsTransportFactory
*/
public static function do($container, $lazyLoad = true)
{
include_once \dirname(__DIR__, 4).'/vendor/symfony/notifier/Transport/TransportFactoryInterface.php';
include_once \dirname(__DIR__, 4).'/vendor/symfony/notifier/Transport/AbstractTransportFactory.php';
include_once \dirname(__DIR__, 4).'/vendor/symfony/fake-sms-notifier/FakeSmsTransportFactory.php';
return new \Symfony\Component\Notifier\Bridge\FakeSms\FakeSmsTransportFactory(($container->privates['mailer.mailer'] ?? self::getMailer_MailerService($container)), ($container->privates['monolog.logger'] ?? self::getMonolog_LoggerService($container)));
}
} The HttpClient and EventDispatcher are replaced, not injected. |
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
If we revert the FrameworkBundle, we must also change the signatures of the bridges Fake* constructor to put Mailer and Logger at the end. |
1737a93
to
9edd5fb
Compare
@xabbuh your last change seems to work with the old bridge, and the modified one. 👍 |
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
Thank you @xabbuh. |
@rdavaillaud Thank you for testing it! |