Skip to content

Commit 528572b

Browse files
committed
minor #17565 [DependencyInjection] simplify the BC layer (xabbuh)
This PR was merged into the 2.7 branch. Discussion ---------- [DependencyInjection] simplify the BC layer | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | The change to the `setFactoryService()` method is consistent with what we did with the `getFactoryService()` before (and how we handle the deprecation of strict references in Symfony 2.8). Commits ------- 6cd5ee3 [DependencyInjection] simplify the BC layer
2 parents 2ef46b3 + 6cd5ee3 commit 528572b

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ public function process(ContainerBuilder $container)
4444
$definition->setMethodCalls($this->processArguments($definition->getMethodCalls()));
4545
$definition->setProperties($this->processArguments($definition->getProperties()));
4646
$definition->setFactory($this->processFactory($definition->getFactory()));
47-
48-
if (null !== $factoryService = $definition->getFactoryService(false)) {
49-
$definition->setFactoryService($this->processFactoryService($factoryService));
50-
}
47+
$definition->setFactoryService($this->processFactoryService($definition->getFactoryService(false)), false);
5148
}
5249

5350
foreach ($container->getAliases() as $id => $alias) {

src/Symfony/Component/DependencyInjection/Definition.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,11 @@ public function getFactoryMethod($triggerDeprecationError = true)
194194
*
195195
* @deprecated since version 2.6, to be removed in 3.0.
196196
*/
197-
public function setFactoryService($factoryService)
197+
public function setFactoryService($factoryService, $triggerDeprecationError = true)
198198
{
199-
@trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryService), E_USER_DEPRECATED);
199+
if ($triggerDeprecationError) {
200+
@trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryService), E_USER_DEPRECATED);
201+
}
200202

201203
$this->factoryService = $factoryService;
202204

src/Symfony/Component/DependencyInjection/DefinitionDecorator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function setFactoryMethod($method)
9999
/**
100100
* {@inheritdoc}
101101
*/
102-
public function setFactoryService($service)
102+
public function setFactoryService($service, $triggerDeprecationError = true)
103103
{
104104
$this->changes['factory_service'] = true;
105105

0 commit comments

Comments
 (0)