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
Bug with isset and !empty in 0.12.51 #3990
Comments
This bug report is missing a link to reproduction on phpstan.org. |
This doesn't help me solve the problem. Can you show more surrounding code? And is it inside function or in the global scope? |
@ondrejmirtes I've created an empty Symfony project with PHPStan 0.12.51 to reproduce this issue. https://github.com/murtukov/phpstan-reproduce-issue Just |
I am using the protected function buildConfigLoader(array $config): void
{
/**
* @var array $fields
* @var string|null $description
* @var array|null $interfaces
* @var string|null $resolveType
* [...]
*
* @phpstan-ignore-next-line
*/
extract($config);
$configLoader = Collection::assoc();
if (isset($description)) {
$configLoader->addItem('description', $description);
}
// ... This is the line in the real project, where this error occurs: |
@ondrejmirtes this reproduction also throws |
@murtukov Depends on the level you're running. |
@ondrejmirtes I'm using level 7 in my project, it still doesn't throw So is this a bug (the issue described in the first message)? |
This is what happens when I run level 5 on your provided example repository:
The message |
@ondrejmirtes you are right, the reason why I didn't get this error in my real project, is that I suppressed it. But the main issue is still there: 0.12.51 introduces |
Fixed: phpstan/phpstan-src@d3e7b9c |
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. |
Bug report
The simple check with
isset()
and!empty()
stopped to work as expected, when I updated to 0.12.51. It worked without errors from 0.12.33 to 0.12.50. I couldn't reproduce it in the playground.Code snippet that reproduces the problem
Expected output
No errors.
Actual output
Undefined variable: $description
The text was updated successfully, but these errors were encountered: