From dec054d330550d4706870b3cdbbd5c51e2880876 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Thu, 12 Aug 2021 15:19:55 +0200 Subject: [PATCH] PDOStatement implements IteratorAggregate on PHP 8 --- stubs/PDOStatement.stub | 3 ++- .../Methods/MissingMethodReturnTypehintRuleTest.php | 5 +++++ tests/PHPStan/Rules/Methods/data/bug-5436.php | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/PHPStan/Rules/Methods/data/bug-5436.php diff --git a/stubs/PDOStatement.stub b/stubs/PDOStatement.stub index 5c63cbce7d..79637d8370 100644 --- a/stubs/PDOStatement.stub +++ b/stubs/PDOStatement.stub @@ -2,9 +2,10 @@ /** * @implements Traversable> + * @implements IteratorAggregate> * @link https://php.net/manual/en/class.pdostatement.php */ -class PDOStatement implements Traversable +class PDOStatement implements Traversable, IteratorAggregate { } diff --git a/tests/PHPStan/Rules/Methods/MissingMethodReturnTypehintRuleTest.php b/tests/PHPStan/Rules/Methods/MissingMethodReturnTypehintRuleTest.php index 5ca9f7ae6b..ac0e206740 100644 --- a/tests/PHPStan/Rules/Methods/MissingMethodReturnTypehintRuleTest.php +++ b/tests/PHPStan/Rules/Methods/MissingMethodReturnTypehintRuleTest.php @@ -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'], []); + } + } diff --git a/tests/PHPStan/Rules/Methods/data/bug-5436.php b/tests/PHPStan/Rules/Methods/data/bug-5436.php new file mode 100644 index 0000000000..0cbba7cffa --- /dev/null +++ b/tests/PHPStan/Rules/Methods/data/bug-5436.php @@ -0,0 +1,11 @@ +