-
-
Notifications
You must be signed in to change notification settings - Fork 938
Closed
Description
Bug report
Not sure if it was already reported but it looks like generics fallback to basic type and does not keep defined type.
Code snippet that reproduces the problem
/**
* @template TValue
*/
class Foo
{
/** @var TValue */
public $value;
/**
* @param TValue $value
*/
public function __construct($value) {
$this->value = $value;
}
}
/** @var class-string<Exception> $exceptionClass */
dumpType((new Foo($exceptionClass))->value);https://phpstan.org/r/94faaba1-0ed2-4d54-8ff0-130a0bf2fb03
Expected output
We expect the value to be of type class-string<Exception>.
Did PHPStan help you today? Did it make you happy in any way?
As always, amazing tool. It makes me more confident on my code. Great job !
Reactions are currently unavailable