Skip to content

Commit

Permalink
Merge pull request #8151 from othercorey/fix-array-sigs
Browse files Browse the repository at this point in the history
Fix array_* function signatures
  • Loading branch information
orklah authored Jun 24, 2022
2 parents cd54574 + 417bf87 commit 9b4c8cb
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 42 deletions.
28 changes: 14 additions & 14 deletions dictionaries/CallMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,12 @@
'ArithmeticError::getTraceAsString' => ['string'],
'array_change_key_case' => ['associative-array', 'array'=>'array', 'case='=>'int'],
'array_chunk' => ['list<array[]>', 'array'=>'array', 'length'=>'int', 'preserve_keys='=>'bool'],
'array_column' => ['array', 'array'=>'array', 'column_key'=>'mixed', 'index_key='=>'mixed'],
'array_column' => ['array', 'array'=>'array', 'column_key'=>'int|string|null', 'index_key='=>'int|string|null'],
'array_combine' => ['associative-array', 'keys'=>'string[]|int[]', 'values'=>'array'],
'array_count_values' => ['associative-array<mixed,int>', 'array'=>'array'],
'array_diff' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_diff_assoc' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_diff_key' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_diff' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
'array_diff_assoc' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
'array_diff_key' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
'array_diff_uassoc' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'data_comp_func'=>'callable(mixed,mixed):int'],
'array_diff_uassoc\'1' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'arr3'=>'array', 'arg4'=>'array|callable(mixed,mixed):int', '...rest='=>'array|callable(mixed,mixed):int'],
'array_diff_ukey' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'key_comp_func'=>'callable(mixed,mixed):int'],
Expand All @@ -375,31 +375,31 @@
'array_fill_keys' => ['array', 'keys'=>'array', 'value'=>'mixed'],
'array_filter' => ['associative-array', 'array'=>'array', 'callback='=>'callable(mixed,mixed=):scalar', 'mode='=>'int'],
'array_flip' => ['associative-array<mixed,int>|associative-array<mixed,string>', 'array'=>'array'],
'array_intersect' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_intersect_assoc' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_intersect_key' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_intersect' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
'array_intersect_assoc' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
'array_intersect_key' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
'array_intersect_uassoc' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'key_compare_func'=>'callable(mixed,mixed):int'],
'array_intersect_uassoc\'1' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'arr3'=>'array', 'arg4'=>'array|callable(mixed,mixed):int', '...rest'=>'array|callable(mixed,mixed):int'],
'array_intersect_ukey' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'key_compare_func'=>'callable(mixed,mixed):int'],
'array_intersect_ukey\'1' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'arr3'=>'array', 'arg4'=>'array|callable(mixed,mixed):int', '...rest'=>'array|callable(mixed,mixed):int'],
'array_is_list' => ['bool', 'array'=>'array'],
'array_key_exists' => ['bool', 'key'=>'string|int', 'array'=>'array|ArrayObject'],
'array_key_exists' => ['bool', 'key'=>'string|int', 'array'=>'array'],
'array_key_first' => ['int|string|null', 'array'=>'array'],
'array_key_last' => ['int|string|null', 'array'=>'array'],
'array_keys' => ['list<string|int>', 'array'=>'array', 'filter_value='=>'mixed', 'strict='=>'bool'],
'array_map' => ['array', 'callback'=>'?callable', 'array'=>'array', '...arrays='=>'array'],
'array_merge' => ['array', 'arrays'=>'array', '...args='=>'array'],
'array_merge_recursive' => ['array', 'arrays'=>'array', '...args='=>'array'],
'array_merge' => ['array', '...arrays='=>'array'],
'array_merge_recursive' => ['array', '...arrays='=>'array'],
'array_multisort' => ['bool', '&rw_array'=>'array', 'rest='=>'array|int', 'array1_sort_flags='=>'array|int', '...args='=>'array|int'],
'array_pad' => ['array', 'array'=>'array', 'length'=>'int', 'value'=>'mixed'],
'array_pop' => ['mixed', '&rw_array'=>'array'],
'array_product' => ['int|float', 'array'=>'array'],
'array_push' => ['int', '&rw_array'=>'array', 'values'=>'mixed', '...vars='=>'mixed'],
'array_push' => ['int', '&rw_array'=>'array', '...values='=>'mixed'],
'array_rand' => ['int|string|array<int,int>|array<int,string>', 'array'=>'non-empty-array', 'num'=>'int'],
'array_rand\'1' => ['int|string', 'array'=>'array'],
'array_reduce' => ['mixed', 'array'=>'array', 'callback'=>'callable(mixed,mixed):mixed', 'initial='=>'mixed'],
'array_replace' => ['array', 'array'=>'array', 'replacements'=>'array', '...args='=>'array'],
'array_replace_recursive' => ['array', 'array'=>'array', 'replacements'=>'array', '...args='=>'array'],
'array_replace' => ['array', 'array'=>'array', '...replacements='=>'array'],
'array_replace_recursive' => ['array', 'array'=>'array', '...replacements='=>'array'],
'array_reverse' => ['array', 'array'=>'array', 'preserve_keys='=>'bool'],
'array_search' => ['int|string|false', 'needle'=>'mixed', 'haystack'=>'array', 'strict='=>'bool'],
'array_shift' => ['mixed|null', '&rw_array'=>'array'],
Expand All @@ -421,7 +421,7 @@
'array_unique' => ['array', 'array'=>'array', 'flags='=>'0'],
'array_unique\'1' => ['array<int|float|string|null>', 'array'=>'array<int|float|string|null>', 'flags='=>'1'],
'array_unique\'2' => ['array<int|float|string|bool|\Stringable|null>', 'array'=>'array<int|float|string|bool|\Stringable|null>', 'flags='=>'2|5'],
'array_unshift' => ['int', '&rw_array'=>'array', 'values'=>'mixed', '...vars='=>'mixed'],
'array_unshift' => ['int', '&rw_array'=>'array', '...values='=>'mixed'],
'array_values' => ['list<mixed>', 'array'=>'array'],
'array_walk' => ['bool', '&rw_array'=>'array', 'callback'=>'callable', 'arg='=>'mixed'],
'array_walk\'1' => ['bool', '&rw_array'=>'object', 'callback'=>'callable', 'arg='=>'mixed'],
Expand Down
8 changes: 8 additions & 0 deletions dictionaries/CallMap_73_delta.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@
'socket_wsaprotocol_info_release' => ['bool', 'info_id'=>'string'],
],
'changed' => [
'array_push' => [
'old' => ['int', '&rw_array'=>'array', '...values'=>'mixed'],
'new' => ['int', '&rw_array'=>'array', '...values='=>'mixed'],
],
'array_unshift' => [
'old' => ['int', '&rw_array'=>'array', '...values'=>'mixed'],
'new' => ['int', '&rw_array'=>'array', '...values='=>'mixed'],
],
'bcscale' => [
'old' => ['int', 'scale'=>'int'],
'new' => ['int', 'scale='=>'int'],
Expand Down
8 changes: 8 additions & 0 deletions dictionaries/CallMap_74_delta.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
'mb_str_split' => ['list<string>|false', 'string'=>'string', 'length='=>'positive-int', 'encoding='=>'string'],
],
'changed' => [
'array_merge' => [
'old' => ['array', '...arrays'=>'array'],
'new' => ['array', '...arrays='=>'array'],
],
'array_merge_recursive' => [
'old' => ['array', '...arrays'=>'array'],
'new' => ['array', '...arrays='=>'array'],
],
'gzread' => [
'old' => ['string|0', 'stream'=>'resource', 'length'=>'int'],
'new' => ['string|false', 'stream'=>'resource', 'length'=>'int'],
Expand Down
32 changes: 32 additions & 0 deletions dictionaries/CallMap_80_delta.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,42 @@
'old' => ['bool', 'name'=>'string', 'content'=>'string', 'isParam'=>'bool', 'publicId'=>'string', 'systemId'=>'string', 'notationData'=>'string'],
'new' => ['bool', 'name'=>'string', 'content'=>'string', 'isParam='=>'bool', 'publicId='=>'?string', 'systemId='=>'?string', 'notationData='=>'?string'],
],
'array_column' => [
'old' => ['array', 'array'=>'array', 'column_key'=>'mixed', 'index_key='=>'mixed'],
'new' => ['array', 'array'=>'array', 'column_key'=>'int|string|null', 'index_key='=>'int|string|null'],
],
'array_combine' => [
'old' => ['associative-array|false', 'keys'=>'string[]|int[]', 'values'=>'array'],
'new' => ['associative-array', 'keys'=>'string[]|int[]', 'values'=>'array'],
],
'array_diff' => [
'old' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'new' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
],
'array_diff_assoc' => [
'old' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'new' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
],
'array_diff_key' => [
'old' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'new' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
],
'array_key_exists' => [
'old' => ['bool', 'key'=>'string|int', 'array'=>'array|object'],
'new' => ['bool', 'key'=>'string|int', 'array'=>'array'],
],
'array_intersect' => [
'old' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'new' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
],
'array_intersect_assoc' => [
'old' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'new' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
],
'array_intersect_key' => [
'old' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'new' => ['associative-array', 'array'=>'array', '...arrays='=>'array'],
],
'bcadd' => [
'old' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int'],
'new' => ['numeric-string', 'num1'=>'numeric-string', 'num2'=>'numeric-string', 'scale='=>'int|null'],
Expand Down
26 changes: 13 additions & 13 deletions dictionaries/CallMap_historical.php
Original file line number Diff line number Diff line change
Expand Up @@ -9510,9 +9510,9 @@
'array_column' => ['array', 'array'=>'array', 'column_key'=>'mixed', 'index_key='=>'mixed'],
'array_combine' => ['associative-array|false', 'keys'=>'string[]|int[]', 'values'=>'array'],
'array_count_values' => ['associative-array<mixed,int>', 'array'=>'array'],
'array_diff' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_diff_assoc' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_diff_key' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_diff' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'array_diff_assoc' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'array_diff_key' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'array_diff_uassoc' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'data_comp_func'=>'callable(mixed,mixed):int'],
'array_diff_uassoc\'1' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'arr3'=>'array', 'arg4'=>'array|callable(mixed,mixed):int', '...rest='=>'array|callable(mixed,mixed):int'],
'array_diff_ukey' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'key_comp_func'=>'callable(mixed,mixed):int'],
Expand All @@ -9521,28 +9521,28 @@
'array_fill_keys' => ['array', 'keys'=>'array', 'value'=>'mixed'],
'array_filter' => ['associative-array', 'array'=>'array', 'callback='=>'callable(mixed,mixed=):scalar', 'mode='=>'int'],
'array_flip' => ['associative-array<mixed,int>|associative-array<mixed,string>', 'array'=>'array'],
'array_intersect' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_intersect_assoc' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_intersect_key' => ['associative-array', 'array'=>'array', 'arrays'=>'array', '...args='=>'array'],
'array_intersect' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'array_intersect_assoc' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'array_intersect_key' => ['associative-array', 'array'=>'array', '...arrays'=>'array'],
'array_intersect_uassoc' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'key_compare_func'=>'callable(mixed,mixed):int'],
'array_intersect_uassoc\'1' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'arr3'=>'array', 'arg4'=>'array|callable(mixed,mixed):int', '...rest'=>'array|callable(mixed,mixed):int'],
'array_intersect_ukey' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'key_compare_func'=>'callable(mixed,mixed):int'],
'array_intersect_ukey\'1' => ['associative-array', 'array'=>'array', 'rest'=>'array', 'arr3'=>'array', 'arg4'=>'array|callable(mixed,mixed):int', '...rest'=>'array|callable(mixed,mixed):int'],
'array_key_exists' => ['bool', 'key'=>'string|int', 'array'=>'array|ArrayObject'],
'array_key_exists' => ['bool', 'key'=>'string|int', 'array'=>'array|object'],
'array_keys' => ['list<string|int>', 'array'=>'array', 'filter_value='=>'mixed', 'strict='=>'bool'],
'array_map' => ['array', 'callback'=>'?callable', 'array'=>'array', '...arrays='=>'array'],
'array_merge' => ['array', 'arrays'=>'array', '...args='=>'array'],
'array_merge_recursive' => ['array', 'arrays'=>'array', '...args='=>'array'],
'array_merge' => ['array', '...arrays'=>'array'],
'array_merge_recursive' => ['array', '...arrays'=>'array'],
'array_multisort' => ['bool', '&rw_array'=>'array', 'rest='=>'array|int', 'array1_sort_flags='=>'array|int', '...args='=>'array|int'],
'array_pad' => ['array', 'array'=>'array', 'length'=>'int', 'value'=>'mixed'],
'array_pop' => ['mixed', '&rw_array'=>'array'],
'array_product' => ['int|float', 'array'=>'array'],
'array_push' => ['int', '&rw_array'=>'array', 'values'=>'mixed', '...vars='=>'mixed'],
'array_push' => ['int', '&rw_array'=>'array', '...values'=>'mixed'],
'array_rand' => ['int|string|array<int,int>|array<int,string>', 'array'=>'non-empty-array', 'num'=>'int'],
'array_rand\'1' => ['int|string', 'array'=>'array'],
'array_reduce' => ['mixed', 'array'=>'array', 'callback'=>'callable(mixed,mixed):mixed', 'initial='=>'mixed'],
'array_replace' => ['array', 'array'=>'array', 'replacements'=>'array', '...args='=>'array'],
'array_replace_recursive' => ['array', 'array'=>'array', 'replacements'=>'array', '...args='=>'array'],
'array_replace' => ['array', 'array'=>'array', '...replacements='=>'array'],
'array_replace_recursive' => ['array', 'array'=>'array', '...replacements='=>'array'],
'array_reverse' => ['array', 'array'=>'array', 'preserve_keys='=>'bool'],
'array_search' => ['int|string|false', 'needle'=>'mixed', 'haystack'=>'array', 'strict='=>'bool'],
'array_shift' => ['mixed|null', '&rw_array'=>'array'],
Expand All @@ -9564,7 +9564,7 @@
'array_unique' => ['array', 'array'=>'array', 'flags='=>'0'],
'array_unique\'1' => ['array<int|float|string|null>', 'array'=>'array<int|float|string|null>', 'flags='=>'1'],
'array_unique\'2' => ['array<int|float|string|bool|\Stringable|null>', 'array'=>'array<int|float|string|bool|\Stringable|null>', 'flags='=>'2|5'],
'array_unshift' => ['int', '&rw_array'=>'array', 'values'=>'mixed', '...vars='=>'mixed'],
'array_unshift' => ['int', '&rw_array'=>'array', '...values'=>'mixed'],
'array_values' => ['list<mixed>', 'array'=>'array'],
'array_walk' => ['bool', '&rw_array'=>'array', 'callback'=>'callable', 'arg='=>'mixed'],
'array_walk\'1' => ['bool', '&rw_array'=>'object', 'callback'=>'callable', 'arg='=>'mixed'],
Expand Down
15 changes: 0 additions & 15 deletions tests/Internal/Codebase/InternalCallMapHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,7 @@ class InternalCallMapHandlerTest extends TestCase
*/
private static $ignoredFunctions = [
'apcu_entry',
'array_column',
'array_diff',
'array_diff_assoc',
'array_diff_key',
'array_intersect',
'array_intersect_assoc',
'array_intersect_key',
'array_key_exists',
'array_merge',
'array_merge_recursive',
'array_multisort',
'array_push',
'array_replace',
'array_replace_recursive',
'array_unshift',
'bcdiv',
'bcmod',
'bcpowmod',
Expand Down Expand Up @@ -348,7 +334,6 @@ class InternalCallMapHandlerTest extends TestCase
'yaml_emit_file',
'zip_entry_close',
'zlib_encode',

];

/**
Expand Down

0 comments on commit 9b4c8cb

Please sign in to comment.