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
Complex array shape not working properly #6364
Comments
Needs Explained here: #5780 (comment) |
@ondrejmirtes Wrong issue 😄 |
Thanks :D |
@sakarikl After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-65: Offset 'jobs' does not exist on array{type: 'Type1'|'Type3', id: string, jobs: array<string, int|string>}|array{type: 'Type2'|'Type4', id: string, job?: string, extractor?: int}.
-69: Offset 'jobs' does not exist on array{type: 'Type1'|'Type3', id: string, jobs: array<string, int|string>}|array{type: 'Type2'|'Type4', id: string, job?: string, extractor?: int}.
+65: Offset 'jobs' does not exist on array{type: 'Type1', id: string, job?: string, extractor?: int}|array{type: 'Type1', id: string, jobs?: array<string, int|string>}.
+69: Offset 'jobs' does not exist on array{type: 'Type3', id: string, job?: string, extractor?: int}|array{type: 'Type3', id: string, jobs: array<string, int|string>}. Full report
|
@sakarikl After the latest commit in 1.6.x, PHPStan now reports different result with your code snippet: @@ @@
-65: Offset 'jobs' does not exist on array{type: 'Type1'|'Type3', id: string, jobs: array<string, int|string>}|array{type: 'Type2'|'Type4', id: string, job?: string, extractor?: int}.
-69: Offset 'jobs' does not exist on array{type: 'Type1'|'Type3', id: string, jobs: array<string, int|string>}|array{type: 'Type2'|'Type4', id: string, job?: string, extractor?: int}.
+65: Offset 'jobs' does not exist on array{type: 'Type1', id: string, job?: string, extractor?: int}|array{type: 'Type1', id: string, jobs: array<string, int|string>}.
+69: Offset 'jobs' does not exist on array{type: 'Type3', id: string, job?: string, extractor?: int}|array{type: 'Type3', id: string, jobs: array<string, int|string>}. Full report
|
@sakarikl After the latest push in 1.8.x, PHPStan now reports different result with your code snippet: @@ @@
-65: Offset 'jobs' does not exist on array{type: 'Type1'|'Type3', id: string, jobs: array<string, int|string>}|array{type: 'Type2'|'Type4', id: string, job?: string, extractor?: int}.
-69: Offset 'jobs' does not exist on array{type: 'Type1'|'Type3', id: string, jobs: array<string, int|string>}|array{type: 'Type2'|'Type4', id: string, job?: string, extractor?: int}.
+No errors |
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
Complex array shape doesn't work with switch that uses different shapes
https://phpstan.org/r/a80de5c7-cec9-4a55-a3cc-059dd6e5bf60
Expected output
Expected no errors
The text was updated successfully, but these errors were encountered: