Closed
Description
Summary of a problem
@method
annotation does not override return type of parent method.
Code snippet that reproduces the problem
I have abstract class which implements \Iterator
interface and realizes method current
abstract class PayloadCollectionEvent implements \Iterator {
// Some inner collection which also implements \Iterator
protected $items;
// Other \Iterator methods
/**
* @inheritdoc
* @return PayloadInterface
*/
public function current()
{
return $this->items->current();
}
}
Also I have child class that have annotation @method
which override reutrn type of method current()
/**
* @method ProductUpdateResponse current()
*/
class ProductBatchUpdateResponseEvent extends PayloadCollectionEvent
{
}
PHPStorm understands that now in foreach
loop item has type ProductUpdateResponse
(which implements PayloadInterface
) not PayloadInterface
but PHPStan still recognizes it as PayloadInterface
Expected output
I expect that PHPStan will recognize that this method should return new type.
Metadata
Metadata
Assignees
Labels
No labels