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 8d79d8c commit abe132f306441cfda620d86bbb74436a46cd4aa3
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 abe132f

Please sign in to comment.
You can’t perform that action at this time.