Sitelet https://github.com/phpstan/phpstan-src/pull/2276
Skip to content

Fix false positive with array_combine() on php8 - #2276

Merged
ondrejmirtes merged 1 commit into
phpstan:1.10.xfrom
staabm:bug9011
Mar 8, 2023
Merged

ondrejmirtes merged 1 commit into
phpstan:1.10.xfrom
staabm:bug9011

Conversation

@staabm

@staabm staabm commented Mar 7, 2023

Copy link
Copy Markdown
Contributor

closes phpstan/phpstan#9011

test fails without fix:

There was 1 failure:

1) PHPStan\Rules\Methods\ReturnTypeRuleTest::testBug9011
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'
+'16: Method Bug9011\HelloWorld::getX() should return array<string> but returns false.
 '

C:\dvl\Workspace\phpstan-src-staabm\src\Testing\RuleTestCase.php:154
C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\Rules\Methods\ReturnTypeRuleTest.php:851

the 2nd example posted in the issue works as expected in my eyes.

@staabm staabm changed the title Fix false positive with ? array_combine()` on php8 Fix false positive with array_combine() on php8 Mar 7, 2023
@staabm
staabm marked this pull request as ready for review March 7, 2023 16:52
@phpstan-bot

Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

@staabm
staabm marked this pull request as draft March 7, 2023 16:54
@clxmstaab
clxmstaab force-pushed the bug9011 branch 2 times, most recently from c2a5376 to 6299bf5 Compare March 7, 2023 16:57
@staabm
staabm marked this pull request as ready for review March 7, 2023 17:07
@phpstan-bot

Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes
ondrejmirtes merged commit 04edd04 into phpstan:1.10.x Mar 8, 2023
@ondrejmirtes

Copy link
Copy Markdown
Member

Thank you.

@staabm
staabm deleted the bug9011 branch March 8, 2023 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive when return array_combine() is used

3 participants