diff --git a/src/DI/ContainerBuilder.php b/src/DI/ContainerBuilder.php index 195ce6b6a..aa0992ee6 100644 --- a/src/DI/ContainerBuilder.php +++ b/src/DI/ContainerBuilder.php @@ -784,9 +784,6 @@ public function formatPhp($statement, $args) if ($val instanceof Statement) { $val = self::literal($this->formatStatement($val)); - } elseif ($val === $this) { - $val = self::literal('$this'); - } elseif ($val instanceof ServiceDefinition) { $val = '@' . current(array_keys($this->getDefinitions(), $val, TRUE)); } @@ -852,9 +849,6 @@ public function normalizeEntity($entity) } elseif ($entity instanceof ServiceDefinition) { // ServiceDefinition -> @serviceName $entity = '@' . current(array_keys($this->definitions, $entity, TRUE)); - - } elseif (is_array($entity) && $entity[0] === $this) { // [$this, ...] -> [@container, ...] - $entity[0] = '@' . self::THIS_CONTAINER; } return $entity; // Class, @service, [Class, member], [@service, member], [, globalFunc], Statement } diff --git a/tests/DI/ContainerBuilder.basic.phpt b/tests/DI/ContainerBuilder.basic.phpt index 62de7ee46..b61b66c1c 100644 --- a/tests/DI/ContainerBuilder.basic.phpt +++ b/tests/DI/ContainerBuilder.basic.phpt @@ -55,7 +55,7 @@ $six = $builder->addDefinition('six') ->addSetup(['@six', 'methodA'], ['a', 'b']); $builder->addDefinition('seven') - ->setFactory([$six, 'create'], [$builder, $six]) + ->setFactory([$six, 'create'], ['@container', $six]) ->addSetup([$six, 'methodA']) ->addSetup('$service->methodA(?)', ['a']);