Skip to content

Commit e67fb84

Browse files
authored
early return
1 parent ee52612 commit e67fb84

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
use function PHPStan\Testing\assertType;
77

88
function testPDOStatementGetIterator(): void {
9-
$pdo = new PDO('sqlite::memory:');
9+
if (PHP_VERSION_ID < 80000) {
10+
echo "Test skipped: PDOStatement::getIterator is only available in PHP 8 and above.";
11+
return;
12+
}
13+
14+
$pdo = new PDO('sqlite::memory:');
1015
$stmt = $pdo->query('SELECT 1');
1116

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-
}
17+
assertType('Iterator', $stmt->getIterator());
1918
}

0 commit comments

Comments
 (0)