fix(IContainer): Override get method with better type annotations

Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
provokateurin 2026-02-16 09:13:54 +01:00
parent 9dc1d6372f
commit 935c2416b5
No known key found for this signature in database

View file

@ -25,6 +25,20 @@ use Psr\Container\NotFoundExceptionInterface;
* @deprecated 20.0.0 use \Psr\Container\ContainerInterface
*/
interface IContainer extends ContainerInterface {
/**
* Finds an entry of the container by its identifier and returns it.
*
* @template T
* @param class-string<T>|string $id Identifier of the entry to look for.
*
* @throws NotFoundExceptionInterface No entry was found for **this** identifier.
* @throws ContainerExceptionInterface Error while retrieving the entry.
*
* @return ($id is class-string<T> ? T : mixed) Entry.
* @since 34.0.0
*/
public function get(string $id);
/**
* @template T
*
@ -33,7 +47,7 @@ interface IContainer extends ContainerInterface {
* @param class-string<T>|string $name
* @return ($name is class-string<T> ? T : mixed)
* @since 8.2.0
* @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get
* @deprecated 20.0.0 use {@see self::get()}
* @throws ContainerExceptionInterface if the class could not be found or instantiated
*/
public function resolve(string $name): mixed;
@ -48,7 +62,7 @@ interface IContainer extends ContainerInterface {
* @throws ContainerExceptionInterface if the query could not be resolved
* @throws NotFoundExceptionInterface if the name could not be found within the container
* @since 6.0.0
* @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get
* @deprecated 20.0.0 use {@see self::get()}
*/
public function query(string $name, bool $autoload = true): mixed;