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
For example, I have the following code:
final class DemoFile { private function complementArticleData(Iterator $articles): void { $result = [ 'artikel' => $articles, 'farben' => null, 'artikel_ids' => [], ]; // collect article ids foreach ($result['artikel'] as $article) { $result['artikel_ids'][] = 1; } if ($result['artikel_ids'] !== []) { $result['farben'] = new stdClass(); } // $result['farben'] might be also null \PHPStan\dumpType($result['farben']); if ($result['farben'] instanceof stdClass) { echo '123'; } } }
Above, \PHPStan\dumpType($result['farben']); should be null|stdClass, but detected only as stdClass.
\PHPStan\dumpType($result['farben']);
null|stdClass
stdClass
https://phpstan.org/r/05fd1758-7df0-4307-b419-dc29bd867ae4
It should output null|stdClass as type.
Array vs Iterator result:
Array: working OK https://phpstan.org/r/dcded1e7-0941-4d6b-9451-c33face0ff89 Iterator: NOT working https://phpstan.org/r/05fd1758-7df0-4307-b419-dc29bd867ae4
No response
The text was updated successfully, but these errors were encountered:
Fixed: phpstan/phpstan-src@853a1e6
Sorry, something went wrong.
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
For example, I have the following code:
Above,
\PHPStan\dumpType($result['farben']);
should benull|stdClass
, but detected only asstdClass
.Code snippet that reproduces the problem
https://phpstan.org/r/05fd1758-7df0-4307-b419-dc29bd867ae4
Expected output
It should output
null|stdClass
as type.Array vs Iterator result:
Array: working OK https://phpstan.org/r/dcded1e7-0941-4d6b-9451-c33face0ff89
Iterator: NOT working https://phpstan.org/r/05fd1758-7df0-4307-b419-dc29bd867ae4
Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: