-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
Bug report
These expressions should be equivalent (when the result of mergeWith cannot be null):
$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.
Code snippet that reproduces the problem
https://phpstan.org/r/a88e69f2-8ca7-471b-beb4-fd427772df0a
Expected output
The dumped type for $mergedExample should be Example.
Did PHPStan help you today? Did it make you happy in any way?
No response
Reactions are currently unavailable