Add more precise types

This commit is contained in:
Yassine Guedidi
2023-05-02 18:42:48 +02:00
parent 432d21b7e9
commit 66bde5f4c5

View File

@@ -27,7 +27,10 @@ final class InitializedSymfonyExtensionEnvironment implements SymfonyExtensionEn
/** @var Suite */ /** @var Suite */
private $suite; private $suite;
/** @var Context[] */ /**
* @var array<class-string<Context>, Context>
* @psalm-var class-string-map<T as Context, T>
*/
private $contexts = []; private $contexts = [];
public function __construct(Suite $suite) public function __construct(Suite $suite)
@@ -74,6 +77,12 @@ final class InitializedSymfonyExtensionEnvironment implements SymfonyExtensionEn
/** /**
* @see http://behat.org/en/latest/cookbooks/accessing_contexts_from_each_other.html * @see http://behat.org/en/latest/cookbooks/accessing_contexts_from_each_other.html
* *
* @template T of Context
*
* @param class-string<T> $class
*
* @return T
*
* @throws ContextNotFoundException * @throws ContextNotFoundException
*/ */
public function getContext(string $class): Context public function getContext(string $class): Context