-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Currently 5.2 Generate something like
/**
* @method Entity[] getIterator()
*/
abstract class EntityResultIterator {
}This is not really true as the ResultIterator::getIterator() function returns a InnerResultIteratorInterface which is defined as:
interface InnerResultIteratorInterface extends \Traversable, \Countable, \ArrayAccessI guess the correct way is to type-hint the whole chain following this phpstan template:
https://phpstan.org/r/f87e4ede-1067-4795-bb40-a8eac8b1f7b8
PHPStan Code Sample
<?php declare(strict_types = 1);
/**
* @template T
*
* @extends Traversable<mixed, T>
* @extends ArrayAccess<mixed, T>
*/
interface HelloWorld extends Countable, Traversable, ArrayAccess
{
}
/**
* @template T
*/
abstract class ATest {
/**
* @return HelloWorld<T>
*/
abstract function getIterator(): HelloWorld;
}
/**
* @extends ATest<Entity>
*/
class Test extends ATest {}
class Entity {}/cc @dsavina
Metadata
Metadata
Assignees
Labels
No labels