Skip to content

Type what PHP's array functions return - #9

Merged
hbenabdallah merged 3 commits into
mainfrom
array-functions
Oct 27, 2026
Merged

hbenabdallah merged 3 commits into
mainfrom
array-functions

Conversation

@hbenabdallah

Copy link
Copy Markdown
Owner

PHP's signatures for array_filter(), array_merge(), reset() and similar functions only say array or mixed, so a call on their result had no known type. The type now comes from the argument: an array of its elements, the elements of every argument for array_merge/array_replace (AMBIGUOUS if one argument's elements are unknown), or a single element for reset, end, array_shift… A project function with the same name still wins.

Corpus, application code (unknown receivers / INFERRED call sites): Sylius −2 / 0, Akeneo −2 / +3, PrestaShop −4 / +5, WordPress −2 / +5. Edge diff: Sylius drops 2 wrong AMBIGUOUS guesses, PrestaShop gains 5 correct edges, and no INFERRED edges are lost. Baseline updated.

Also on this branch: typing a global variable by its @global tag, and the MIT license with the French README brought in line with the English one.

@hbenabdallah
hbenabdallah merged commit 14daef8 into main Oct 27, 2026
8 checks passed
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.

1 participant