Psalm: Add support for tuples

Created on 5 Mar 2020  路  3Comments  路  Source: vimeo/psalm

Sometimes you need to hint a tuple before destructuring it. I seems that currently we can achieve that only with array{0: string, 1: int} hint, which is verbose and error-prone.

I suggest introducing one of the following enhancements to resolve the issue:

  • array{string, int}
  • array-tuple{string, int}
  • list{string, int}

Most helpful comment

Although one enhancement that could be made would be to treat array{string, int} as an explicit list, as opposed to a dictionary as it is now

All 3 comments

Hey @vudaltsov, can you reproduce the issue on https://psalm.dev ?

@vudaltsov your first example already works!

Although one enhancement that could be made would be to treat array{string, int} as an explicit list, as opposed to a dictionary as it is now

Was this page helpful?
0 / 5 - 0 ratings

Related issues

orklah picture orklah  路  3Comments

SignpostMarv picture SignpostMarv  路  3Comments

roukmoute picture roukmoute  路  3Comments

Rarst picture Rarst  路  3Comments

Pierstoval picture Pierstoval  路  3Comments