diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-10-12 13:15:40 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-10-14 12:29:26 +0200 |
commit | f9f20b63f4d98bd316f03b35ca3c3222aa333d49 (patch) | |
tree | 9b6209f0add3ad8c9a25fa2d0b3a428a05067f7d /lib | |
parent | a41b273bcd1a99e5db1ccf63f677a3fb459505d7 (diff) | |
download | nextcloud-server-f9f20b63f4d98bd316f03b35ca3c3222aa333d49.tar.gz nextcloud-server-f9f20b63f4d98bd316f03b35ca3c3222aa333d49.zip |
Annotate IContainer so Psalm knows what resove and query return
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/IContainer.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/public/IContainer.php b/lib/public/IContainer.php index 74fdf4aba5b..cb29e522032 100644 --- a/lib/public/IContainer.php +++ b/lib/public/IContainer.php @@ -52,10 +52,14 @@ use Psr\Container\ContainerInterface; interface IContainer extends ContainerInterface { /** + * @template T + * * If a parameter is not registered in the container try to instantiate it * by using reflection to find out how to build the class * @param string $name the class name to resolve + * @psalm-param string|class-string<T> $name * @return \stdClass + * @psalm-return ($name is class-string ? T : mixed) * @since 8.2.0 * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get * @throws ContainerExceptionInterface if the class could not be found or instantiated @@ -66,9 +70,13 @@ interface IContainer extends ContainerInterface { /** * Look up a service for a given name in the container. * + * @template T + * * @param string $name + * @psalm-param string|class-string<T> $name * @param bool $autoload Should we try to autoload the service. If we are trying to resolve built in types this makes no sense for example * @return mixed + * @psalm-return ($name is class-string ? T : mixed) * @throws ContainerExceptionInterface if the query could not be resolved * @throws QueryException if the query could not be resolved * @since 6.0.0 |