Skip to content

Commit 467a301

Browse files
committed
don't require fake notifier transport to be installed as non-dev dependencies
1 parent 80b0826 commit 467a301

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -2812,8 +2812,6 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
28122812
NotifierBridge\Engagespot\EngagespotTransportFactory::class => 'notifier.transport_factory.engagespot',
28132813
NotifierBridge\Esendex\EsendexTransportFactory::class => 'notifier.transport_factory.esendex',
28142814
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',
28172815
NotifierBridge\Firebase\FirebaseTransportFactory::class => 'notifier.transport_factory.firebase',
28182816
NotifierBridge\FortySixElks\FortySixElksTransportFactory::class => 'notifier.transport_factory.forty-six-elks',
28192817
NotifierBridge\FreeMobile\FreeMobileTransportFactory::class => 'notifier.transport_factory.free-mobile',
@@ -2891,20 +2889,26 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
28912889
$container->removeDefinition($classToServices[NotifierBridge\Mercure\MercureTransportFactory::class]);
28922890
}
28932891

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])
2892+
// don't use ContainerBuilder::willBeAvailable() as these are not needed in production
2893+
if (class_exists(NotifierBridge\FakeChat\FakeChatTransportFactory::class)) {
2894+
$container->getDefinition('notifier.transport_factory.fake-chat')
28962895
->replaceArgument(0, new Reference('mailer'))
28972896
->replaceArgument(1, new Reference('logger'))
28982897
->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
28992898
->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
2899+
} else {
2900+
$container->removeDefinition('notifier.transport_factory.fake-chat');
29002901
}
29012902

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])
2903+
// don't use ContainerBuilder::willBeAvailable() as these are not needed in production
2904+
if (class_exists(NotifierBridge\FakeSms\FakeSmsTransportFactory::class)) {
2905+
$container->getDefinition('notifier.transport_factory.fake-sms')
29042906
->replaceArgument(0, new Reference('mailer'))
29052907
->replaceArgument(1, new Reference('logger'))
29062908
->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
29072909
->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
2910+
} else {
2911+
$container->removeDefinition('notifier.transport_factory.fake-sms');
29082912
}
29092913

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

0 commit comments

Comments
 (0)