We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
<?php declare(strict_types = 1); class Bar { /** * @var array|mixed|null */ private $bar = null; /** * @return array|mixed|null */ public function getBar() { return $this->bar; } } class Foo { public function getFoo(Bar $bar): void { $array = (array) $bar->getBar(); $statusCode = array_key_exists('key', $array) ? (string) $array['key'] : null; } }
24 | Parameter #2 $array of function array_key_exists expects array, array given.
https://phpstan.org/r/e1579418-17bf-46dc-8c57-97e382ccde79
Obviously $array is array. But PhpStan thinks different (=
$array
The text was updated successfully, but these errors were encountered:
@Anamelash After the latest commit in dev-master, PHPStan now reports different result with your code snippet:
@@ @@ -PHP 8.0 (1 error) -========== - -24: Parameter #2 $array of function array_key_exists expects array, array given. - -PHP 7.1 – 7.4 (1 error) -========== - -24: Parameter #2 $search of function array_key_exists expects array, array given. +No errors
Sorry, something went wrong.
phpstan/phpstan-src@57405af
Regression tests
f3e759e
Closes phpstan/phpstan#5834 Closes phpstan/phpstan#5881 Closes phpstan/phpstan#5872 Closes phpstan/phpstan#5861
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.
No branches or pull requests
Bug report
https://phpstan.org/r/e1579418-17bf-46dc-8c57-97e382ccde79
Obviously
$array
is array. But PhpStan thinks different (=The text was updated successfully, but these errors were encountered: