From ed777c7c9b94dfed2bf883b227607f85c648c8e4 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Tue, 4 Aug 2026 14:58:39 +0200 Subject: [PATCH] Make ContainerInterface::get a generic If we prove a class-string to the get method, returns the class T. If we provide anything yet, return the current mixed result. Signed-off-by: Carl Schwan --- src/ContainerInterface.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ContainerInterface.php b/src/ContainerInterface.php index b2cad40..990286f 100644 --- a/src/ContainerInterface.php +++ b/src/ContainerInterface.php @@ -17,6 +17,9 @@ interface ContainerInterface * @throws NotFoundExceptionInterface No entry was found for **this** identifier. * @throws ContainerExceptionInterface Error while retrieving the entry. * + * @psalm-template T + * @psalm-param class-string|string $serviceName + * @psalm-return ($serviceName is class-string ? T : mixed) * @return mixed Entry. */ public function get(string $id);