Skip to content

Commit

Permalink
Processor: definition of 'type' will not overide 'factory' of parent …
Browse files Browse the repository at this point in the history
…service (BC break) (#39)
  • Loading branch information
dg committed Mar 14, 2019
1 parent 368865f commit fafd328
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/DI/Config/Processor.php
Expand Up @@ -195,22 +195,18 @@ private function updateServiceDefinition(Definitions\ServiceDefinition $definiti
{
$config = self::processArguments($config);

if (array_key_exists('type', $config) || array_key_exists('factory', $config)) {
if (array_key_exists('factory', $config)) {
$definition->setFactory($config['factory']);
$definition->setType(null);
$definition->setFactory(null);
}

if (array_key_exists('type', $config)) {
if ($config['type'] instanceof Statement) {
trigger_error("Service '$name': option 'type' or 'class' should be changed to 'factory'.", E_USER_DEPRECATED);
$definition->setFactory($config['type']);
} else {
$definition->setType($config['type']);
}
$definition->setFactory($config['type']);
}

if (array_key_exists('factory', $config)) {
$definition->setFactory($config['factory']);
}

if (array_key_exists('arguments', $config)) {
Expand Down

0 comments on commit fafd328

Please sign in to comment.