Skip to content

Commit 3917ca9

Browse files
authored
Fix PDOStatement getIterator return type
1 parent 48a2910 commit 3917ca9

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

stubs/PDOStatement.stub

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,9 @@ class PDOStatement implements Traversable, IteratorAggregate
1919
* @return array{name: string, table?: string, native_type?: string, len: int, flags: array<int, string>, precision: int<0, max>, pdo_type: PDO::PARAM_* }|false
2020
*/
2121
public function getColumnMeta(int $column) {}
22+
23+
/**
24+
* @return Iterator
25+
*/
26+
public function getIterator() {}
2227
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php // lint >= 8.0
2+
3+
namespace Bug8886;
4+
5+
use PDO;
6+
use function PHPStan\Testing\assertType;
7+
8+
function testPDOStatementGetIterator(): void {
9+
$pdo = new PDO('sqlite::memory:');
10+
$stmt = $pdo->query('SELECT 1');
11+
12+
assertType('Iterator', $stmt->getIterator());
13+
}

0 commit comments

Comments
 (0)