Skip to content

Support List<Foo> rebased#83

Closed
orklah wants to merge 2 commits intophpstan:masterfrom
orklah:list-type
Closed

Support List<Foo> rebased#83
orklah wants to merge 2 commits intophpstan:masterfrom
orklah:list-type

Conversation

@orklah
Copy link
Copy Markdown
Contributor

@orklah orklah commented Jan 3, 2020

This is a new edition of #79 because the first one was messy.

@ondrejmirtes
Copy link
Copy Markdown
Member

Merged as a2c0403, thank you!

@orklah orklah deleted the list-type branch January 4, 2020 11:01
@szepeviktor
Copy link
Copy Markdown
Contributor

@orklah What is the list type? is it array<int, mixed>?

@szepeviktor
Copy link
Copy Markdown
Contributor

I see :) #79 (comment)

@orklah
Copy link
Copy Markdown
Contributor Author

orklah commented Jan 6, 2020

@orklah What is the list type? is it array<int, mixed>?

Yes, for now, it is just aliases. However, there is a much bigger meaning behind it that wasn't implemented for now. It is best described in Psalm documentation:
https://psalm.dev/docs/annotating_code/type_syntax/array_types/#lists

Psalm supports a list type that represents continuous, integer-indexed arrays like ["red", "yellow", "blue"] .
These arrays have the property $arr === array_values($arr), and represent a large percentage of all array usage in PHP applications.

It is a subset of array<int, mixed> where the indexes have no gap and start at 0.

@szepeviktor
Copy link
Copy Markdown
Contributor

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants