-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
Method B::get() should return T of Exception but returns Exception.
Code snippet that reproduces the problem
https://phpstan.org/r/baf364ba-e98e-4685-9e28-6b9446e99340
<?php declare(strict_types = 1);
/**
* @phpstan-template T of \Exception
*/
abstract class A
{
/**
* @phpstan-return T
*/
abstract public function factory();
/**
* @phpstan-return T
*/
public function get() {
return $this->factory();
}
}
/**
* @phpstan-template T of \Exception
*/
class B
{
/** @var A<\Exception> $a */
public $a;
/**
* @phpstan-return T
*/
public function get() {
return $a->get();
}
}Expected output
No error.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels