Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Annotate IContainer so Psalm knows what resove and query return
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst authored and MorrisJobke committed Oct 14, 2020
commit f9f20b63f4d98bd316f03b35ca3c3222aa333d49
8 changes: 8 additions & 0 deletions lib/public/IContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@
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
Expand All @@ -66,9 +70,13 @@ public function resolve($name);
/**
* 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
Expand Down