Skip to content

Commit dec054d

Browse files
committed
PDOStatement implements IteratorAggregate on PHP 8
1 parent eb15c46 commit dec054d

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

stubs/PDOStatement.stub

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
/**
44
* @implements Traversable<array<int|string, mixed>>
5+
* @implements IteratorAggregate<array<int|string, mixed>>
56
* @link https://php.net/manual/en/class.pdostatement.php
67
*/
7-
class PDOStatement implements Traversable
8+
class PDOStatement implements Traversable, IteratorAggregate
89
{
910

1011
}

tests/PHPStan/Rules/Methods/MissingMethodReturnTypehintRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,9 @@ public function testBug5089(): void
7777
$this->analyse([__DIR__ . '/data/bug-5089.php'], []);
7878
}
7979

80+
public function testBug5436(): void
81+
{
82+
$this->analyse([__DIR__ . '/data/bug-5436.php'], []);
83+
}
84+
8085
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Bug5436;
4+
5+
final class PDO extends \PDO
6+
{
7+
public function query(string $query, ?int $fetchMode = null, ...$fetchModeArgs)
8+
{
9+
return parent::query($query, $fetchMode, ...$fetchModeArgs);
10+
}
11+
}

0 commit comments

Comments
 (0)