@@ -526,7 +526,8 @@ parameter and in PHP config use the ``Reference`` class:
526526 $services = $configurator->services();
527527
528528 $services->set(MessageGenerator::class)
529- ->args([ref('logger')])
529+ // In versions earlier to Symfony 5.1 the service() function was called ref()
530+ ->args([service('logger')])
530531 ;
531532 };
532533
@@ -633,7 +634,7 @@ But, you can control this and pass in a different logger:
633634
634635 // explicitly configure the service
635636 $services->set(SiteUpdateManager::class)
636- ->arg('$logger', ref ('monolog.logger.request'))
637+ ->arg('$logger', service ('monolog.logger.request'))
637638 ;
638639 };
639640
@@ -738,15 +739,15 @@ You can also use the ``bind`` keyword to bind specific arguments by name or type
738739
739740 // pass this service to any $requestLogger argument for any
740741 // service that's defined in this file
741- ->bind('$requestLogger', ref ('monolog.logger.request'))
742+ ->bind('$requestLogger', service ('monolog.logger.request'))
742743
743744 // pass this service for any LoggerInterface type-hint for any
744745 // service that's defined in this file
745- ->bind(LoggerInterface::class, ref ('monolog.logger.request'))
746+ ->bind(LoggerInterface::class, service ('monolog.logger.request'))
746747
747748 // optionally you can define both the name and type of the argument to match
748749 ->bind('string $adminEmail', 'manager@example.com')
749- ->bind(LoggerInterface::class.' $requestLogger', ref ('monolog.logger.request'))
750+ ->bind(LoggerInterface::class.' $requestLogger', service ('monolog.logger.request'))
750751 ->bind('iterable $rules', tagged_iterator('app.foo.rule'))
751752 ;
752753
@@ -1113,16 +1114,16 @@ admin email. In this case, each needs to have a unique service id:
11131114 ->autowire(false)
11141115 // manually wire all arguments
11151116 ->args([
1116- ref (MessageGenerator::class),
1117- ref ('mailer'),
1117+ service (MessageGenerator::class),
1118+ service ('mailer'),
11181119 'superadmin@example.com',
11191120 ]);
11201121
11211122 $services->set('site_update_manager.normal_users', SiteUpdateManager::class)
11221123 ->autowire(false)
11231124 ->args([
1124- ref (MessageGenerator::class),
1125- ref ('mailer'),
1125+ service (MessageGenerator::class),
1126+ service ('mailer'),
11261127 'contact@example.com',
11271128 ]);
11281129
0 commit comments