@@ -85,8 +85,9 @@ private function loadDefinition(?string $name, \stdClass $config): void
8585 */
8686 private function updateServiceDefinition (Definitions \ServiceDefinition $ definition , \stdClass $ config ): void
8787 {
88+ $ desc = $ definition ->getDescriptor ();
8889 if ($ config ->create ) {
89- $ definition ->setFactory (Helpers::filterArguments ([$ config ->create ])[0 ]);
90+ $ definition ->setFactory (Helpers::filterArguments ([$ config ->create ], $ desc )[0 ]);
9091 $ definition ->setType (null );
9192 }
9293
@@ -95,7 +96,7 @@ private function updateServiceDefinition(Definitions\ServiceDefinition $definiti
9596 }
9697
9798 if ($ config ->arguments ) {
98- $ arguments = Helpers::filterArguments ($ config ->arguments );
99+ $ arguments = Helpers::filterArguments ($ config ->arguments , $ desc );
99100 if (empty ($ config ->reset ['arguments ' ]) && !Nette \Utils \Arrays::isList ($ arguments )) {
100101 $ arguments = array_replace ($ definition ->getFactory ()->arguments , $ arguments );
101102 }
@@ -108,7 +109,7 @@ private function updateServiceDefinition(Definitions\ServiceDefinition $definiti
108109 $ definition ->setSetup ([]);
109110 }
110111
111- foreach (Helpers::filterArguments ($ config ->setup ) as $ id => $ setup ) {
112+ foreach (Helpers::filterArguments ($ config ->setup , $ desc ) as $ id => $ setup ) {
112113 if (is_array ($ setup )) {
113114 $ setup = new Statement (key ($ setup ), array_values ($ setup ));
114115 }
@@ -138,22 +139,23 @@ private function updateAccessorDefinition(Definitions\AccessorDefinition $defini
138139 private function updateFactoryDefinition (Definitions \FactoryDefinition $ definition , \stdClass $ config ): void
139140 {
140141 $ resultDef = $ definition ->getResultDefinition ();
142+ $ desc = $ definition ->getDescriptor ();
141143
142144 if (isset ($ config ->implement )) {
143145 $ definition ->setImplement ($ config ->implement );
144146 $ definition ->setAutowired (true );
145147 }
146148
147149 if ($ config ->create ) {
148- $ resultDef ->setFactory (Helpers::filterArguments ([$ config ->create ])[0 ]);
150+ $ resultDef ->setFactory (Helpers::filterArguments ([$ config ->create ], $ desc )[0 ]);
149151 }
150152
151153 if ($ config ->type ) {
152154 $ resultDef ->setFactory ($ config ->type );
153155 }
154156
155157 if ($ config ->arguments ) {
156- $ arguments = Helpers::filterArguments ($ config ->arguments );
158+ $ arguments = Helpers::filterArguments ($ config ->arguments , $ desc );
157159 if (empty ($ config ->reset ['arguments ' ]) && !Nette \Utils \Arrays::isList ($ arguments )) {
158160 $ arguments = array_replace ($ resultDef ->getFactory ()->arguments , $ arguments );
159161 }
@@ -166,7 +168,7 @@ private function updateFactoryDefinition(Definitions\FactoryDefinition $definiti
166168 $ resultDef ->setSetup ([]);
167169 }
168170
169- foreach (Helpers::filterArguments ($ config ->setup ) as $ id => $ setup ) {
171+ foreach (Helpers::filterArguments ($ config ->setup , $ desc ) as $ id => $ setup ) {
170172 if (is_array ($ setup )) {
171173 $ setup = new Statement (key ($ setup ), array_values ($ setup ));
172174 }
0 commit comments