@@ -45,6 +45,7 @@ public function setType(?string $type): static
4545
4646 /**
4747 * Alias for setCreator()
48+ * @param string|array{string|Reference|Statement, string}|Definition|Reference|Statement $factory
4849 * @param array<int|string, mixed> $args
4950 */
5051 public function setFactory (string |array |Definition |Reference |Statement $ factory , array $ args = []): static
@@ -62,7 +63,10 @@ public function getFactory(): Statement
6263 }
6364
6465
65- /** @param array<int|string, mixed> $args */
66+ /**
67+ * @param string|array{string|Reference|Statement, string}|Definition|Reference|Statement $creator
68+ * @param array<int|string, mixed> $args
69+ */
6670 public function setCreator (string |array |Definition |Reference |Statement $ creator , array $ args = []): static
6771 {
6872 $ this ->creator = $ creator instanceof Statement
@@ -124,7 +128,10 @@ public function getSetup(): array
124128 }
125129
126130
127- /** @param array<int|string, mixed> $args */
131+ /**
132+ * @param string|array{string|Reference|Statement, string}|Definition|Reference|Statement $entity
133+ * @param array<int|string, mixed> $args
134+ */
128135 public function addSetup (string |array |Definition |Reference |Statement $ entity , array $ args = []): static
129136 {
130137 $ entity = $ entity instanceof Statement
@@ -151,6 +158,7 @@ public function resolveType(Nette\DI\Resolver $resolver): void
151158 throw new ServiceCreationException ('Unknown service type, specify it or declare return type of factory method. ' );
152159 }
153160
161+ /** @var class-string $type */
154162 $ this ->setType ($ type );
155163 $ resolver ->addDependency (new \ReflectionClass ($ type ));
156164 }
@@ -196,6 +204,7 @@ public function generateMethod(Nette\PhpGenerator\Method $method, Nette\DI\PhpGe
196204 if ($ this ->canBeLazy () && !preg_grep ('#(?:func_get_arg|func_num_args)#i ' , $ lines )) { // latteFactory workaround
197205 $ class = $ this ->creator ->getEntity ();
198206 assert (is_string ($ class ));
207+ /** @var class-string $class */
199208 $ lines [0 ] = (new \ReflectionClass ($ class ))->hasMethod ('__construct ' )
200209 ? $ generator ->formatPhp ("\$service->__construct(...?:); \n" , [$ this ->creator ->arguments ])
201210 : '' ;
0 commit comments