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); $data = [ 'c1' => 12, 'rasd' => 13, 'c34' => 15, ]; foreach ($data as $key => $value) { $match = []; if (false === preg_match('/^c(\d+)$/', $key, $match) || empty($match)) { continue; } var_dump($key); var_dump($value); }
https://phpstan.org/r/68e9cca9-06c3-48ad-8f3c-4e395f9da991
https://3v4l.org/ZY9FG
Expected no errors
If preg_match is done outside of if works as expected
https://phpstan.org/r/66f21acd-abc8-463f-af11-92ac0cb700c0
The text was updated successfully, but these errors were encountered:
Another example: https://phpstan.org/r/11e31de8-66df-453f-8be7-c1b78fa2e676
Sorry, something went wrong.
phpstan/phpstan-src@989dd6f
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/68e9cca9-06c3-48ad-8f3c-4e395f9da991
https://3v4l.org/ZY9FG
Expected output
Expected no errors
If preg_match is done outside of if works as expected
https://phpstan.org/r/66f21acd-abc8-463f-af11-92ac0cb700c0
The text was updated successfully, but these errors were encountered: