From 6dc43ce41cd58bd83166302a15a90516394a1be3 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 --- psalm-baseline.xml | 30 +++---------------- .../ReflectionBasedAbstractFactory.php | 4 ++- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 22164e32..56dc5922 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 @@ -504,6 +481,7 @@ $second $shared + $shared $callback() diff --git a/src/AbstractFactory/ReflectionBasedAbstractFactory.php b/src/AbstractFactory/ReflectionBasedAbstractFactory.php index 4f4654bd..93783dc9 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 as object */ public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null) {