Feature request
There is a method that returns a subset of another array shape and has the following signature:
/**
* @phpstan-type config array{"string1":array{one:int},"string2":array{two:int}}
*/
class SomeClass
{
/**
* @template TKey of string
* @param TKey $key
*
* @return array{TKey: config[TKey]}
*/
public function config(string $key): array
{}
}
Currently PHPStan doesn't understand the template type when used as an array key.
The expected result would be:
$subset = $config->get('string1');
\PHPStan\dumpType($subset); // array{string1:array{one:int}}
Did PHPStan help you today? Did it make you happy in any way?
Always happy to see that PHPStan handles more than I expect it to :)
Feature request
There is a method that returns a subset of another array shape and has the following signature:
Currently PHPStan doesn't understand the template type when used as an array key.
The expected result would be:
Did PHPStan help you today? Did it make you happy in any way?
Always happy to see that PHPStan handles more than I expect it to :)