Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a8e3976

Browse filesBrowse files
committed
don't require fake notifier transports to be installed as non-dev dependencies
1 parent b7716f1 commit a8e3976
Copy full SHA for a8e3976

File tree

1 file changed

+16
-10
lines changed
Filter options

1 file changed

+16
-10
lines changed

‎DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: DependencyInjection/FrameworkExtension.php
+16-10Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.