You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ERROR: InvalidReturnStatement - 15:16 - The type 'array<array-key, mixed>' does not match the declared return type 'array<T1 as array-key, T2 as mixed>' for iterableToArray
ERROR: InvalidReturnType - 8:12 - The declared return type 'array<T1, T2>' for iterableToArray is incorrect, got 'array<T1|array-key, T2|mixed>'
The text was updated successfully, but these errors were encountered:
muglug
changed the title
Casting down iterable in else branch sometimes doesn't work
Casting down iterable in else branch sometimes doesn't preserve type params
Aug 12, 2019
Hi ! I'm still having this kind of issue despite being on v3.6.4 : result is marked as array, and calling sleep(iterableToArray($x)) raises a MixedArgument issue : https://psalm.dev/r/cc8c7ed010
#1997 fixed most issues. However, Psalm still has trouble inferring the types for this function.
Removing
T1
fixes the issue.Example (https://psalm.dev/r/aa78059e8a):
Example output:
The text was updated successfully, but these errors were encountered: