Description
Bug report
Hello,
in my current work (PHP 8.2), i have used (for the first time) PDOStatement::getIterator() for a custom Repository :
protected function executeIterator(string $sql, array $params = []): \Iterator
{
$stmt = $this->dbConn->prepare($sql);
$stmt->execute($params);
return $stmt->getIterator();
}
The following error occurs when i run phpstan:
AbstractRepository::executeIterator() should return Iterator but returns Traversable<mixed, array<int|string, mixed>>
But according to the documentation, PDOStatement::getIterator returns an Iterator:
public PDOStatement::getIterator(): Iterator
Code snippet that reproduces the problem
Here the URL of a snippet : https://phpstan.org/r/1043c9a2-812c-4a95-bdac-e89b4c865656
Expected output
This error should not be displayed.
Did PHPStan help you today? Did it make you happy in any way?
Ho yes it helps me a lot ! And not only today !
I had once a migration from an older PHP version to PHP 8 and PHPStan was fundamental in my work.
I am no sure i could have done this migration without it!
So many thanks for your work !!
Your work is so helpful that i cannot imagine working without PHPStan !
Thank you again !