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
This commit is contained in:
Fabien Potencier 2016-01-27 16:32:31 +01:00
commit 528572b764
3 changed files with 6 additions and 7 deletions

View File

@ -44,10 +44,7 @@ class ResolveReferencesToAliasesPass implements CompilerPassInterface
$definition->setMethodCalls($this->processArguments($definition->getMethodCalls()));
$definition->setProperties($this->processArguments($definition->getProperties()));
$definition->setFactory($this->processFactory($definition->getFactory()));
if (null !== $factoryService = $definition->getFactoryService(false)) {
$definition->setFactoryService($this->processFactoryService($factoryService));
}
$definition->setFactoryService($this->processFactoryService($definition->getFactoryService(false)), false);
}
foreach ($container->getAliases() as $id => $alias) {

View File

@ -194,9 +194,11 @@ class Definition
*
* @deprecated since version 2.6, to be removed in 3.0.
*/
public function setFactoryService($factoryService)
public function setFactoryService($factoryService, $triggerDeprecationError = true)
{
@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);
if ($triggerDeprecationError) {
@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);
}
$this->factoryService = $factoryService;

View File

@ -99,7 +99,7 @@ class DefinitionDecorator extends Definition
/**
* {@inheritdoc}
*/
public function setFactoryService($service)
public function setFactoryService($service, $triggerDeprecationError = true)
{
$this->changes['factory_service'] = true;