@@ -22,6 +22,9 @@ abstract class AbstractConfigurator
22
22
{
23
23
const FACTORY = 'unknown ' ;
24
24
25
+ /** @internal */
26
+ protected $ definition ;
27
+
25
28
public function __call ($ method , $ args )
26
29
{
27
30
if (method_exists ($ this , 'set ' .$ method )) {
@@ -37,7 +40,7 @@ public function __call($method, $args)
37
40
* @param mixed $value
38
41
* @param bool $allowServices whether Definition and Reference are allowed; by default, only scalars and arrays are
39
42
*
40
- * @return mixed the value, optionaly cast to a Definition/Reference
43
+ * @return mixed the value, optionally cast to a Definition/Reference
41
44
*/
42
45
public static function processValue ($ value , $ allowServices = false )
43
46
{
@@ -50,32 +53,14 @@ public static function processValue($value, $allowServices = false)
50
53
}
51
54
52
55
if ($ value instanceof ReferenceConfigurator) {
53
- static $ refCast ;
54
-
55
- if (!$ refCast ) {
56
- $ refCast = \Closure::bind (function ($ value ) {
57
- return new Reference ($ value ->id , $ value ->invalidBehavior );
58
- }, null , $ value );
59
- }
60
-
61
- // cast ReferenceConfigurator to Reference
62
- return $ refCast ($ value );
56
+ return new Reference ($ value ->id , $ value ->invalidBehavior );
63
57
}
64
58
65
59
if ($ value instanceof InlineServiceConfigurator) {
66
- static $ defCast ;
67
-
68
- if (!$ defCast ) {
69
- $ defCast = \Closure::bind (function ($ value ) {
70
- $ def = $ value ->definition ;
71
- $ value ->definition = null ;
72
-
73
- return $ def ;
74
- }, null , $ value );
75
- }
60
+ $ def = $ value ->definition ;
61
+ $ value ->definition = null ;
76
62
77
- // cast InlineServiceConfigurator to Definition
78
- return $ defCast ($ value );
63
+ return $ def ;
79
64
}
80
65
81
66
if ($ value instanceof self) {
0 commit comments