Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive on is_array && array_is_list #9381

Closed
Niiph opened this issue May 31, 2023 · 3 comments
Closed

False positive on is_array && array_is_list #9381

Niiph opened this issue May 31, 2023 · 3 comments
Labels
Milestone

Comments

@Niiph
Copy link

Niiph commented May 31, 2023

Bug report

False positive on is_array() && !array_is_list() and later is_array()

Code snippet that reproduces the problem

https://phpstan.org/r/0687e733-025b-401f-8f21-21df9bdd1e88

Expected output

Should not return error since there are still arrays that returned false for !array_is_list()

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Jun 6, 2023
@phpstan-bot
Copy link
Contributor

@Niiph After the latest push in 1.11.x, PHPStan now reports different result with your code snippet:

@@ @@
-PHP 8.1 – 8.2 (1 error)
+PHP 8.1 – 8.2
 ==========
 
-16: Call to function is_array() with mixed will always evaluate to false.
+No errors
 
 PHP 7.2 – 8.0 (1 error)
 ==========
 
 13: Function array_is_list not found.
Full report

PHP 8.1 – 8.2

No errors

PHP 7.2 – 8.0 (1 error)

Line Error
13 Function array_is_list not found.

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@de2566a

@github-actions
Copy link

github-actions bot commented Jul 8, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants