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
Optional keys on objects can be coalesced, but in PHPStan they result in the error type.
This works:
class Test {} $a = new \stdClass(); $b = new Test(); var_dump($a->optional ?? null, $b->optional ?? null);
Accessing $b->optional without coalesce results in Warning: Undefined property.
$b->optional
Warning: Undefined property
https://phpstan.org/r/1f24e6ab-289c-45ad-861c-1f7455f55723
Both types should be int|null
int|null
It does! I get excited every time a new PhpStan version is released!
The text was updated successfully, but these errors were encountered:
Potentially related to/fixed by #2834
Sorry, something went wrong.
Fixed: phpstan/phpstan-src@d801919
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
Optional keys on objects can be coalesced, but in PHPStan they result in the error type.
This works:
Accessing
$b->optional
without coalesce results inWarning: Undefined property
.Code snippet that reproduces the problem
https://phpstan.org/r/1f24e6ab-289c-45ad-861c-1f7455f55723
Expected output
Both types should be
int|null
Did PHPStan help you today? Did it make you happy in any way?
It does! I get excited every time a new PhpStan version is released!
The text was updated successfully, but these errors were encountered: