@@ -22,6 +22,9 @@ abstract class AbstractConfigurator
2222{
2323 const FACTORY = 'unknown ' ;
2424
25+ /** @internal */
26+ protected $ definition ;
27+
2528 public function __call ($ method , $ args )
2629 {
2730 if (method_exists ($ this , 'set ' .$ method )) {
@@ -37,7 +40,7 @@ public function __call($method, $args)
3740 * @param mixed $value
3841 * @param bool $allowServices whether Definition and Reference are allowed; by default, only scalars and arrays are
3942 *
40- * @return mixed the value, optionaly cast to a Definition/Reference
43+ * @return mixed the value, optionally cast to a Definition/Reference
4144 */
4245 public static function processValue ($ value , $ allowServices = false )
4346 {
@@ -50,32 +53,14 @@ public static function processValue($value, $allowServices = false)
5053 }
5154
5255 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 );
6357 }
6458
6559 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 ;
7662
77- // cast InlineServiceConfigurator to Definition
78- return $ defCast ($ value );
63+ return $ def ;
7964 }
8065
8166 if ($ value instanceof self) {
0 commit comments