Skip to content

Commit

Permalink
Fix return type to generic in ReflectionBasedAbstractFactory
Browse files Browse the repository at this point in the history
Signed-off-by: Witold Wasiczko <[email protected]>
  • Loading branch information
snapshotpl committed Feb 28, 2024
1 parent c97780e commit 6dc43ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
30 changes: 4 additions & 26 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,27 @@
<file src="src/AbstractFactory/ReflectionBasedAbstractFactory.php">
<ArgumentTypeCoercion>
<code>$requestedName</code>
<code>$requestedName</code>
</ArgumentTypeCoercion>
<LessSpecificReturnStatement>
<InvalidStringClass>
<code>new $requestedName()</code>
<code>new $requestedName()</code>
<code>new $requestedName(...$parameters)</code>
</LessSpecificReturnStatement>
</InvalidStringClass>
<MissingClosureReturnType>
<code>function (ReflectionParameter $parameter) use ($container, $requestedName) {</code>
</MissingClosureReturnType>
<MissingParamType>
<code>$requestedName</code>
</MissingParamType>
<MixedArgument>
<code>$requestedName</code>
<code>$requestedName</code>
<code>$requestedName</code>
</MixedArgument>
<MixedMethodCall>
<code>new $requestedName()</code>
<code>new $requestedName()</code>
<code>new $requestedName(...$parameters)</code>
</MixedMethodCall>
<MoreSpecificReturnType>
<code>DispatchableInterface</code>
</MoreSpecificReturnType>
<PossiblyNullArgument>
<code>$type</code>
</PossiblyNullArgument>
<RedundantCondition>
<code>is_string($type)</code>
</RedundantCondition>
<UndefinedDocblockClass>
<code>DispatchableInterface</code>
</UndefinedDocblockClass>
</file>
<file src="src/AbstractFactoryInterface.php">
<PossiblyUnusedMethod>
Expand Down Expand Up @@ -350,16 +337,6 @@
</InvalidArgument>
</file>
<file src="test/AbstractFactory/ReflectionBasedAbstractFactoryTest.php">
<DocblockTypeContradiction>
<code>assertInstanceOf</code>
<code>assertInstanceOf</code>
<code>assertInstanceOf</code>
<code>assertInstanceOf</code>
<code>assertInstanceOf</code>
<code>assertInstanceOf</code>
<code>assertInstanceOf</code>
<code>assertInstanceOf</code>
</DocblockTypeContradiction>
<MixedInferredReturnType>
<code>array</code>
</MixedInferredReturnType>
Expand Down Expand Up @@ -504,6 +481,7 @@
<code><![CDATA[$object[$shared ? $method : 'build'][]]]></code>
<code>$second</code>
<code>$shared</code>
<code>$shared</code>
</MixedAssignment>
<MixedFunctionCall>
<code>$callback()</code>
Expand Down
4 changes: 3 additions & 1 deletion src/AbstractFactory/ReflectionBasedAbstractFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ public function __construct(array $aliases = [])
/**
* {@inheritDoc}
*
* @return DispatchableInterface
* @param class-string<T>|string $requestedName
* @return ($requestedName is class-string<T> ? T : object)
* @template T as object
*/
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
Expand Down

0 comments on commit 6dc43ce

Please sign in to comment.