graphql-php
graphql-php copied to clipboard
PHPStan > `iterable<string, mixed>` removes all other type safety
I'm trying to modify the values
of the EnumType
config. I do this, by copying the value, execute the callback if needed, modify the array, then write the array back. I don't change the structure, only a value.
But PHPStan keeps saying:
Array (array{values: (callable(): iterable<int, string>|iterable<string, mixed>)|iterable<int|string, mixed>}) does not accept (callable(): iterable<int, string>|iterable<string, mixed>)|iterable<int|string, mixed>.
Please have a look here: https://phpstan.org/r/3c29b577-3ba2-4d17-8bc9-d0284e3c9a36
I believe this is because iterable<string, mixed>
is used and therefore PHPStan drops all type safety.
How to solve this? Is this a PHPStan issue?
Looks like a bug in PHPStan, the reassignment of the copy should definitely work. I think the best way forward is to shrink the example to a minimal reproduction and post a bug report at PHPStan.
Closing due to lack of feedback.