Narrowing generic array #10606
Unanswered
gaborjonas
asked this question in
Support
Replies: 1 comment 2 replies
-
are you using the https://github.com/phpstan/phpstan-doctrine ? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm using Doctrine DBAL to fetch records from DB.
PhpStan reports the following issue:
getFromDB() should return array<int, array{id: int, name: string, description: string|null}> but returns array<int, array<string, mixed>>.
I can get around it by duplicating the array shape inside the method, which isn't ideal.
Is there a simpler way to do this?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions