10000 Move factory reference expand into definition class · symfony/symfony@3b7bc89 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3b7bc89

Browse files
committed
Move factory reference expand into definition class
1 parent 1d07a22 commit 3b7bc89

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ protected function getConstructor(Definition $definition, $required)
127127
}
128128

129129
if ($factory) {
130-
if ($factory instanceof Reference) {
131-
$factory = [$factory, '__invoke'];
132-
}
133130
list($class, $method) = $factory;
134131
if ($class instanceof Reference) {
135132
$class = $this->container->findDefinition((string) $class)->getClass();

src/Symfony/Component/DependencyInjection/Definition.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ public function setFactory($factory)
107107
$factory = explode('::', $factory, 2);
108108
}
109109

110+
if ($factory instanceof Reference) {
111+
$factory = [$factory, '__invoke'];
112+
}
113+
110114
$this->factory = $factory;
111115

112116
return $this;
@@ -782,7 +786,7 @@ public function getDeprecationMessage($id)
782786
/**
783787
* Sets a configurator to call after the service is fully initialized.
784788
*
785-
* @param string|array $configurator A PHP callable
789+
* @param string|array|Reference $configurator A PHP function or an array containing a class/Reference and a method to call
786790
*
787791
* @return $this
788792
*/
@@ -794,6 +798,10 @@ public function setConfigurator($configurator)
794798
$configurator = explode('::', $configurator, 2);
795799
}
796800

801+
if ($configurator instanceof Reference) {
802+
$configurator = [$configurator, '__invoke'];
803+
}
804+
797805
$this->configurator = $configurator;
798806

799807
return $this;

0 commit comments

Comments
 (0)
0