From 2592e400a71602e45211f5cad368348571f10d8a Mon Sep 17 00:00:00 2001 From: Witold Wasiczko Date: Wed, 28 Feb 2024 16:57:08 +0100 Subject: [PATCH] Fix return type to generic in ReflectionBasedAbstractFactory Signed-off-by: Witold Wasiczko Signed-off-by: Witold Wasiczko Fix --- psalm-baseline.xml | 29 ++----------------- .../ReflectionBasedAbstractFactory.php | 4 ++- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 22164e32..93ad38ad 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -19,40 +19,27 @@ $requestedName + $requestedName - + new $requestedName() new $requestedName() new $requestedName(...$parameters) - + function (ReflectionParameter $parameter) use ($container, $requestedName) { - - $requestedName - - - $requestedName - $requestedName - $requestedName - new $requestedName() new $requestedName() new $requestedName(...$parameters) - - DispatchableInterface - $type is_string($type) - - DispatchableInterface - @@ -350,16 +337,6 @@ - - assertInstanceOf - assertInstanceOf - assertInstanceOf - assertInstanceOf - assertInstanceOf - assertInstanceOf - assertInstanceOf - assertInstanceOf - array diff --git a/src/AbstractFactory/ReflectionBasedAbstractFactory.php b/src/AbstractFactory/ReflectionBasedAbstractFactory.php index 4f4654bd..cfb90b05 100644 --- a/src/AbstractFactory/ReflectionBasedAbstractFactory.php +++ b/src/AbstractFactory/ReflectionBasedAbstractFactory.php @@ -106,7 +106,9 @@ public function __construct(array $aliases = []) /** * {@inheritDoc} * - * @return DispatchableInterface + * @param class-string|string $requestedName + * @return ($requestedName is class-string ? T : object) + * @template T of object */ public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null) {