Fix ArrayCountValuesDynamicReturnTypeExtension
$type->toArrayKey() instanceof ErrorType is not the right check cause true, false, 1.0, null, ... are ignored by the function. It has to be an int or a string.
And numeric string wasn't casted into int when used as array key.
Looks like it should be $allowedValues->isSuperTypeOf(...)
Looks like it should be $allowedValues->isSuperTypeOf(...)
How you deal with something like "int|null" ? I dont see the benefit with keeping the unionType check and calling filterType on it rather than doing an intersection like I did.
I see now, that you also need the normalized result. its not just a check for compatibility. my suggestion did not fit that.
good catches, didn't think to try other scalar types :+1: