8000 bug #59213 [FrameworkBundle] don't require fake notifier transports t… · symfony/symfony@62ef125 · GitHub
[go: up one dir, main page]

Skip to content

Commit 62ef125

Browse files
bug #59213 [FrameworkBundle] don't require fake notifier transports to be installed as non-dev dependencies (xabbuh)
This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle] don't require fake notifier transports to be installed as non-dev dependencies | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #58929 | License | MIT Commits ------- cf64a86 don't require fake notifier transports to be installed as non-dev dependencies
2 parents 80b0826 + cf64a86 commit 62ef125

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@
122122
use Symfony\Component\Mime\MimeTypeGuesserInterface;
123123
use Symfony\Component\Mime\MimeTypes;
124124
use Symfony\Component\Notifier\Bridge as NotifierBridge;
125+
use Symfony\Component\Notifier\Bridge\FakeChat\FakeChatTransportFactory;
126+
use Symfony\Component\Notifier\Bridge\FakeSms\FakeSmsTransportFactory;
125127
use Symfony\Component\Notifier\ChatterInterface;
126128
use Symfony\Component\Notifier\Notifier;
127129
use Symfony\Component\Notifier\Recipient\Recipient;
@@ -2812,8 +2814,6 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
28122814
NotifierBridge\Engagespot\EngagespotTransportFactory::class => 'notifier.transport_factory.engagespot',
28132815
NotifierBridge\Esendex\EsendexTransportFactory::class => 'notifier.transport_factory.esendex',
28142816
NotifierBridge\Expo\ExpoTransportFactory::class => 'notifier.transport_factory.expo',
2815-
NotifierBridge\FakeChat\FakeChatTransportFactory::class => 'notifier.transport_factory.fake-chat',
2816-
NotifierBridge\FakeSms\FakeSmsTransportFactory::class => 'notifier.transport_factory.fake-sms',
28172817
NotifierBridge\Firebase\FirebaseTransportFactory::class => 'notifier.transport_factory.firebase',
28182818
NotifierBridge\FortySixElks\FortySixElksTransportFactory::class => 'notifier.transport_factory.forty-six-elks',
28192819
NotifierBridge\FreeMobile\FreeMobileTransportFactory::class => 'notifier.transport_factory.free-mobile',
@@ -2891,20 +2891,26 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
28912891
$container->removeDefinition($classToServices[NotifierBridge\Mercure\MercureTransportFactory::class]);
28922892
}
28932893

2894-
if (ContainerBuilder::willBeAvailable('symfony/fake-chat-notifier', NotifierBridge\FakeChat\FakeChatTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) {
2895-
$container->getDefinition($classToServices[NotifierBridge\FakeChat\FakeChatTransportFactory::class])
2896-
->replaceArgument(0, new Reference('mailer'))
2897-
->replaceArgument(1, new Reference('logger'))
2894+
// don't use ContainerBuilder::willBeAvailable() as these are not needed in production
2895+
if (class_exists(FakeChatTransportFactory::class)) {
2896+
$container->getDefinition('notifier.transport_factory.fake-chat')
2897+
->replaceArgument(0, new Reference('mailer', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
2898+
->replaceArgument(1, new Reference('logger', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
28982899
->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
28992900
->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
2901+
} else {
2902+
$container->removeDefinition('notifier.transport_factory.fake-chat');
29002903
}
29012904

2902-
if (ContainerBuilder::willBeAvailable('symfony/fake-sms-notifier', NotifierBridge\FakeSms\FakeSmsTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) {
2903-
$container->getDefinition($classToServices[NotifierBridge\FakeSms\FakeSmsTransportFactory::class])
2904-
->replaceArgument(0, new Reference('mailer'))
2905-
->replaceArgument(1, new Reference('logger'))
2905+
// don't use ContainerBuilder::willBeAvailable() as these are not needed in production
2906+
if (class_exists(FakeSmsTransportFactory::class)) {
2907+
$container->getDefinition('notifier.transport_factory.fake-sms')
2908+
->replaceArgument(0, new Reference('mailer', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
2909+
->replaceArgument(1, new Reference('logger', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
29062910
->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
29072911
->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
2912+
} else {
2913+
$container->removeDefinition('notifier.transport_factory.fake-sms');
29082914
}
29092915

29102916
if (isset($config['admin_recipients'])) {

0 commit comments

Comments
 (0)
0