Skip to content

Commit

Permalink
PDOStatement implements IteratorAggregate on PHP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Aug 12, 2021
1 parent eb15c46 commit dec054d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stubs/PDOStatement.stub
Expand Up @@ -2,9 +2,10 @@

/**
* @implements Traversable<array<int|string, mixed>>
* @implements IteratorAggregate<array<int|string, mixed>>
* @link https://php.net/manual/en/class.pdostatement.php
*/
class PDOStatement implements Traversable
class PDOStatement implements Traversable, IteratorAggregate
{

}
Expand Up @@ -77,4 +77,9 @@ public function testBug5089(): void
$this->analyse([__DIR__ . '/data/bug-5089.php'], []);
}

public function testBug5436(): void
{
$this->analyse([__DIR__ . '/data/bug-5436.php'], []);
}

}
11 changes: 11 additions & 0 deletions tests/PHPStan/Rules/Methods/data/bug-5436.php
@@ -0,0 +1,11 @@
<?php

namespace Bug5436;

final class PDO extends \PDO
{
public function query(string $query, ?int $fetchMode = null, ...$fetchModeArgs)
{
return parent::query($query, $fetchMode, ...$fetchModeArgs);
}
}

0 comments on commit dec054d

Please sign in to comment.