Skip to content
Permalink
Browse files

DecoratorExtension: uses $def->getResultDefinition() on FactoryDefini…

…tion (#190)
  • Loading branch information...
MartkCz authored and dg committed Mar 13, 2019
1 parent fafd328 commit 805e3c8dabfbb723d880a2ac638775f9ce5fa0df
Showing with 8 additions and 0 deletions.
  1. +3 −0 src/DI/Extensions/DecoratorExtension.php
  2. +5 −0 tests/DI/DecoratorExtension.factories.phpt
@@ -41,6 +41,9 @@ public function beforeCompile()
public function addSetups(string $type, array $setups): void
{
foreach ($this->findByType($type) as $def) {
if ($def instanceof Definitions\FactoryDefinition) {
$def = $def->getResultDefinition();
}
foreach ($setups as $setup) {
if (is_array($setup)) {
$setup = new Definitions\Statement(key($setup), array_values($setup));
@@ -23,6 +23,9 @@ interface FooFactory
class Foo
{
public function testSetup(string $foo): void
{
}
}
@@ -32,6 +35,8 @@ $container = createContainer($compiler, '
decorator:
Foo:
inject: yes
setup:
- testSetup(foo)
FooFactory:
tags: [a]
services:

0 comments on commit 805e3c8

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.