Skip to content

Commit ac4cf73

Browse files
committed
PHP7.4 doesn't have PDOStatement::getIterator()
1 parent 0679c46 commit ac4cf73

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/PHPStan/Analyser/nsrt/bug-8886.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,12 @@
88
function testPDOStatementGetIterator(): void {
99
$pdo = new PDO('sqlite::memory:');
1010
$stmt = $pdo->query('SELECT 1');
11-
assertType('Iterator', $stmt->getIterator());
11+
12+
if (PHP_VERSION_ID >= 80000) {
13+
// PHP 8 and above
14+
assertType('Iterator', $stmt->getIterator());
15+
} else {
16+
// Fallback for PHP 7.4
17+
assertType('Traversable', $stmt);
18+
}
1219
}

0 commit comments

Comments
 (0)