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
Support refinement of tagged unions of array shapes #6469
Comments
Array unions are currently collapsed improperly. See #3801. |
Sometimes they are, but not in this case: https://phpstan.org/r/5722f56e-2429-4bfa-9ef2-78b733286287 |
One additional case from #6499 reposting it here for the bot's enjoyment :P |
Another example from @simPod https://phpstan.org/r/2ab591eb-3a1c-434e-9c96-c46b8ef53efb |
See #7666 |
@arnaud-lb After the latest push in 1.8.x, PHPStan now reports different result with your code snippet: @@ @@
-18: Dumped type: array{type: 'pizza', salsa: string}|array{type: 'pizza', toppings: array<string>}
-20: Dumped type: array{type: 'pasta', salsa: string}|array{type: 'pasta', toppings: array<string>}
+18: Dumped type: array{type: 'pizza', toppings: array<string>}
+20: Dumped type: array{type: 'pasta', salsa: string} Full report
|
@ondrejmirtes After the latest push in 1.8.x, PHPStan now reports different result with your code snippet: @@ @@
17: Dumped type: array{type: 'pasta', salsa: string}|array{type: 'pizza', toppings: array<string>}
-19: Dumped type: array{type: 'pizza', salsa: string}|array{type: 'pizza', toppings: array<string>}
-21: Dumped type: array{type: 'pasta', salsa: string}|array{type: 'pasta', toppings: array<string>}
+19: Dumped type: array{type: 'pizza', toppings: array<string>}
+21: Dumped type: array{type: 'pasta', salsa: string} Full report
|
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. |
Feature request
If we have some types like
PHPStan could be able to determine which Meal we have after looking at the
type
field:https://phpstan.org/r/cacfda2a-94de-4bb6-8da6-2c0d36732967
Flow documentation on disjoint unions: https://flow.org/en/docs/types/unions/#toc-disjointo-object-unions
The text was updated successfully, but these errors were encountered: