Skip to content

Commit

Permalink
ContainerBuilder: object ContainerBuilder in Statement is not longer …
Browse files Browse the repository at this point in the history
…alias for `@container` (BC break)
  • Loading branch information
dg committed May 11, 2016
1 parent 1353841 commit a71f267
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/DI/ContainerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ public function formatPhp($statement, $args)
$val = self::literal($this->formatStatement($val));

} elseif ($val === $this) {
trigger_error("Replace object ContainerBuilder in Statement arguments with '@container'.", E_USER_DEPRECATED);
$val = self::literal('$this');

} elseif ($val instanceof ServiceDefinition) {
Expand Down Expand Up @@ -875,6 +876,7 @@ public function normalizeEntity($entity)
$entity = '@' . current(array_keys($this->definitions, $entity, TRUE));

} elseif (is_array($entity) && $entity[0] === $this) { // [$this, ...] -> [@container, ...]
trigger_error("Replace object ContainerBuilder in Statement entity with '@container'.", E_USER_DEPRECATED);
$entity[0] = '@' . self::THIS_CONTAINER;
}
return $entity; // Class, @service, [Class, member], [@service, member], [, globalFunc], Statement
Expand Down
2 changes: 1 addition & 1 deletion tests/DI/ContainerBuilder.basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down

0 comments on commit a71f267

Please sign in to comment.