Use list-shapes for functionMap return types that are guaranteed lists#6024
Open
zonuexe wants to merge 1 commit into
Open
Use list-shapes for functionMap return types that are guaranteed lists#6024zonuexe wants to merge 1 commit into
zonuexe wants to merge 1 commit into
Conversation
These functions return arrays whose keys are always 0..n-1 in ascending
order, so spell them as list{...} instead of array{...} / array{0: ...}.
Currently a semantic no-op (both spellings resolve to the same type), but
it keeps these signatures list-typed under the stricter array-shape
semantics proposed in phpstan/phpstan#14939, where plain array-shapes
no longer guarantee key order.
Refs phpstan/phpstan#14939
VincentLanglet
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spell functionMap return types that are guaranteed lists as
list{...}.Semantically a no-op today (both spellings resolve to the same type) — this prevents these signatures from losing list-ness under the stricter array-shape semantics proposed in phpstan/phpstan#14939.
Supersedes the functionMap part of #3872 (adds
hrtime,preg_splitwithPREG_SPLIT_OFFSET_CAPTURE, andsys_getloadavg; excludesgetimagesize— string keys, a genuine map — andeach— its runtime key order1, 'value', 0, 'key'is genuinely not a list).