Call to function in_array() with arguments *NEVER*... #4489
CassandraKoenen
started this conversation in
General
Replies: 1 comment 2 replies
-
|
Hi, to answer this question, I need a reproduction on phpstan.org, thank you. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
recently I got the following phpStan error:
Line 70: Call to function in_array() with arguments *NEVER*, array<int, string> and true will always evaluate to true.My code is
Both
$this->itemMetaHashesand$this->currentMetaHashesare arrays of strings.When I do a type annotation above the second if-statement, the phpStan error doesn't occur anymore:
/** @var string $hash */I don't understand why this happens. It looks like phpStan looses the information about the type of
$hashduring the first if-statement.Can somebody explain to me why this is the case?
Thanks,
Cassandra
Beta Was this translation helpful? Give feedback.
All reactions