@@ -46,7 +46,7 @@ public function autowire(string|array|callable $target): callable
4646 return new $ target (...$ arguments );
4747 }
4848
49- if (\is_object ($ target ) && \is_callable ( $ target ) ) {
49+ if (\is_object ($ target )) {
5050 $ arguments = $ this ->resolveArguments ([$ target , '__invoke ' ]);
5151
5252 return \call_user_func ($ target , ...$ arguments );
@@ -56,14 +56,14 @@ public function autowire(string|array|callable $target): callable
5656 $ this ->throwAutowireException ($ target , '' );
5757 }
5858
59- $ object = $ target [0 ] ?? null ;
60- $ method = $ target [1 ] ?? null ;
59+ $ object = $ target [0 ] ?? null ; // @phpstan-ignore-line
60+ $ method = $ target [1 ] ?? null ; // @phpstan-ignore-line
6161 $ arguments = null ;
6262
6363 if (\is_object ($ object )) {
6464 if (!$ method ) {
6565 if (!\is_callable ($ object )) {
66- $ this ->throwAutowireException ($ target , sprintf ('Object `%s` is not callable. ' , $ object ::class));
66+ $ this ->throwAutowireException ($ target , \ sprintf ('Object `%s` is not callable. ' , $ object ::class));
6767 }
6868
6969 if (!($ object instanceof \Closure)) {
@@ -117,7 +117,7 @@ protected function resolveStringAsObject(string $target): object
117117 *
118118 * @phpstan-ignore-next-line
119119 */
120- protected function throwAutowireException (string |array |callable $ target , string $ message , \Throwable $ parent = null ): void
120+ protected function throwAutowireException (string |array |callable $ target , string $ message , ? \Throwable $ parent = null ): void
121121 {
122122 if (\is_array ($ target )) {
123123 $ target = $ target [0 ] ?? null ;
@@ -131,13 +131,13 @@ protected function throwAutowireException(string|array|callable $target, string
131131 $ target = $ target ::class;
132132 }
133133
134- throw new AutowireException (sprintf ('Can not autowire "%s". %s ' , $ target , $ message ), 0 , $ parent );
134+ throw new AutowireException (\ sprintf ('Can not autowire "%s". %s ' , $ target , $ message ), 0 , $ parent );
135135 }
136136
137137 /**
138138 * @phpstan-ignore-next-line
139139 */
140- protected function resolveArguments (string |array |object $ target , string $ method = null ): array
140+ protected function resolveArguments (string |array |object $ target , ? string $ method = null ): array
141141 {
142142 if (\is_callable ($ target ) && !$ method && !\is_string ($ target )) {
143143 $ ref = new \ReflectionFunction ($ target ); // @phpstan-ignore-line
@@ -162,7 +162,7 @@ protected function resolveArguments(string|array|object $target, string $method
162162 }
163163
164164 /**
165- * @throws \Psr\Container\ ContainerExceptionInterface
165+ * @throws ContainerExceptionInterface
166166 * @throws NotFoundExceptionInterface
167167 *
168168 * @phpstan-ignore-next-line
@@ -177,7 +177,7 @@ private function resolveArgumentsFromReflectionParametersObject(array $reflectio
177177 $ parameterName = $ parameter ->getName ();
178178 if (!$ parameterType ) {
179179 if (!$ allowedNull ) {
180- throw new \InvalidArgumentException (sprintf ('The untyped argument `%s` cannot be autowired. ' , $ parameterName ));
180+ throw new \InvalidArgumentException (\ sprintf ('The untyped argument `%s` cannot be autowired. ' , $ parameterName ));
181181 }
182182
183183 $ arguments [] = null ;
@@ -188,7 +188,7 @@ private function resolveArgumentsFromReflectionParametersObject(array $reflectio
188188 if (
189189 !$ parameterType instanceof \ReflectionNamedType
190190 ) {
191- throw new \InvalidArgumentException (sprintf ('The argument `%s` has invalid type. ' , $ parameterName ));
191+ throw new \InvalidArgumentException (\ sprintf ('The argument `%s` has invalid type. ' , $ parameterName ));
192192 }
193193
194194 $ parameterTypeName = $ parameterType ->getName ();
0 commit comments