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
These expressions should be equivalent (when the result of mergeWith cannot be null):
mergeWith
$mergedExample = $mergedExample !== null ? $mergedExample->mergeWith() : $example;
$mergedExample = $mergedExample?->mergeWith() ?? $example;
The expression with the null safe operator results in mixed for $mergedExample, the ternary expression is analysed correctly.
mixed
$mergedExample
https://phpstan.org/r/a88e69f2-8ca7-471b-beb4-fd427772df0a
The dumped type for $mergedExample should be Example.
Example
No response
The text was updated successfully, but these errors were encountered:
@leongersen After the latest push in 1.11.x, PHPStan now reports different result with your code snippet:
@@ @@ 17: Dumped type: Example -21: Dumped type: mixed +21: Dumped type: Example
Dumped type: Example
Sorry, something went wrong.
phpstan/phpstan-src@7031d82
Thank you @ondrejmirtes 😄
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
These expressions should be equivalent (when the result of
mergeWith
cannot be null):The expression with the null safe operator results in
mixed
for$mergedExample
, the ternary expression is analysed correctly.Code snippet that reproduces the problem
https://phpstan.org/r/a88e69f2-8ca7-471b-beb4-fd427772df0a
Expected output
The dumped type for
$mergedExample
should beExample
.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: