Skip to content

Commit 2592e40

Browse files
committed
Fix return type to generic in ReflectionBasedAbstractFactory
Signed-off-by: Witold Wasiczko <[email protected]> Signed-off-by: Witold Wasiczko <[email protected]> Fix
1 parent c97780e commit 2592e40

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

psalm-baseline.xml

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,27 @@
1919
<file src="src/AbstractFactory/ReflectionBasedAbstractFactory.php">
2020
<ArgumentTypeCoercion>
2121
<code>$requestedName</code>
22+
<code>$requestedName</code>
2223
</ArgumentTypeCoercion>
23-
<LessSpecificReturnStatement>
24+
<InvalidStringClass>
2425
<code>new $requestedName()</code>
2526
<code>new $requestedName()</code>
2627
<code>new $requestedName(...$parameters)</code>
27-
</LessSpecificReturnStatement>
28+
</InvalidStringClass>
2829
<MissingClosureReturnType>
2930
<code>function (ReflectionParameter $parameter) use ($container, $requestedName) {</code>
3031
</MissingClosureReturnType>
31-
<MissingParamType>
32-
<code>$requestedName</code>
33-
</MissingParamType>
34-
<MixedArgument>
35-
<code>$requestedName</code>
36-
<code>$requestedName</code>
37-
<code>$requestedName</code>
38-
</MixedArgument>
3932
<MixedMethodCall>
4033
<code>new $requestedName()</code>
4134
<code>new $requestedName()</code>
4235
<code>new $requestedName(...$parameters)</code>
4336
</MixedMethodCall>
44-
<MoreSpecificReturnType>
45-
<code>DispatchableInterface</code>
46-
</MoreSpecificReturnType>
4737
<PossiblyNullArgument>
4838
<code>$type</code>
4939
</PossiblyNullArgument>
5040
<RedundantCondition>
5141
<code>is_string($type)</code>
5242
</RedundantCondition>
53-
<UndefinedDocblockClass>
54-
<code>DispatchableInterface</code>
55-
</UndefinedDocblockClass>
5643
</file>
5744
<file src="src/AbstractFactoryInterface.php">
5845
<PossiblyUnusedMethod>
@@ -350,16 +337,6 @@
350337
</InvalidArgument>
351338
</file>
352339
<file src="test/AbstractFactory/ReflectionBasedAbstractFactoryTest.php">
353-
<DocblockTypeContradiction>
354-
<code>assertInstanceOf</code>
355-
<code>assertInstanceOf</code>
356-
<code>assertInstanceOf</code>
357-
<code>assertInstanceOf</code>
358-
<code>assertInstanceOf</code>
359-
<code>assertInstanceOf</code>
360-
<code>assertInstanceOf</code>
361-
<code>assertInstanceOf</code>
362-
</DocblockTypeContradiction>
363340
<MixedInferredReturnType>
364341
<code>array</code>
365342
</MixedInferredReturnType>

src/AbstractFactory/ReflectionBasedAbstractFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ public function __construct(array $aliases = [])
106106
/**
107107
* {@inheritDoc}
108108
*
109-
* @return DispatchableInterface
109+
* @param class-string<T>|string $requestedName
110+
* @return ($requestedName is class-string<T> ? T : object)
111+
* @template T of object
110112
*/
111113
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
112114
{

0 commit comments

Comments
 (0)