Skip to content

Commit

Permalink
Unified iterator parameter names across PHP versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 26, 2021
1 parent d28b61b commit 72b02a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions resources/functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
'apd_set_session_trace' => ['void', 'debug_level'=>'int', 'dump_directory='=>'string'],
'apd_set_session_trace_socket' => ['bool', 'tcp_server'=>'string', 'socket_type'=>'int', 'port'=>'int', 'debug_level'=>'int'],
'AppendIterator::__construct' => ['void'],
'AppendIterator::append' => ['void', 'it'=>'iterator'],
'AppendIterator::append' => ['void', 'iterator'=>'iterator'],
'AppendIterator::current' => ['mixed'],
'AppendIterator::getArrayIterator' => ['ArrayIterator'],
'AppendIterator::getInnerIterator' => ['iterator'],
Expand Down Expand Up @@ -492,7 +492,7 @@
'bzopen' => ['resource|false', 'file'=>'string|resource', 'mode'=>'string'],
'bzread' => ['string|false', 'bz'=>'resource', 'length='=>'int'],
'bzwrite' => ['int|false', 'bz'=>'resource', 'data'=>'string', 'length='=>'int'],
'CachingIterator::__construct' => ['void', 'it'=>'iterator', 'flags='=>''],
'CachingIterator::__construct' => ['void', 'iterator'=>'iterator', 'flags='=>''],
'CachingIterator::__toString' => ['string'],
'CachingIterator::count' => ['0|positive-int'],
'CachingIterator::current' => ['mixed'],
Expand Down Expand Up @@ -925,7 +925,7 @@
'call_user_func_array' => ['mixed', 'function'=>'callable', 'parameters'=>'array<int,mixed>'],
'call_user_method' => ['mixed', 'method_name'=>'string', 'obj'=>'object', 'parameter='=>'mixed', '...args='=>'mixed'],
'call_user_method_array' => ['mixed', 'method_name'=>'string', 'obj'=>'object', 'params'=>'array<int,mixed>'],
'CallbackFilterIterator::__construct' => ['void', 'it'=>'iterator', 'func'=>'callable'],
'CallbackFilterIterator::__construct' => ['void', 'iterator'=>'iterator', 'func'=>'callable'],
'CallbackFilterIterator::accept' => ['bool'],
'CallbackFilterIterator::current' => ['mixed'],
'CallbackFilterIterator::getInnerIterator' => ['iterator'],
Expand Down Expand Up @@ -2974,7 +2974,7 @@
'filter_list' => ['array'],
'filter_var' => ['mixed', 'variable'=>'mixed', 'filter='=>'int', 'options='=>'mixed'],
'filter_var_array' => ['array|false|null', 'data'=>'array', 'definition='=>'mixed', 'add_empty='=>'bool'],
'FilterIterator::__construct' => ['void', 'it'=>'iterator'],
'FilterIterator::__construct' => ['void', 'iterator'=>'iterator'],
'FilterIterator::accept' => ['bool'],
'FilterIterator::current' => ['mixed'],
'FilterIterator::getInnerIterator' => ['Iterator'],
Expand Down Expand Up @@ -5285,7 +5285,7 @@
'inclued_get_data' => ['array'],
'inet_ntop' => ['string|false', 'in_addr'=>'string'],
'inet_pton' => ['string|false', 'ip_address'=>'string'],
'InfiniteIterator::__construct' => ['void', 'it'=>'iterator'],
'InfiniteIterator::__construct' => ['void', 'iterator'=>'iterator'],
'InfiniteIterator::next' => ['void'],
'inflate_add' => ['string|false', 'context'=>'resource', 'encoded_data'=>'string', 'flush_mode='=>'int'],
'inflate_get_read_len' => ['int|false', 'resource'=>'resource'],
Expand Down Expand Up @@ -5664,11 +5664,11 @@
'Iterator::next' => ['void'],
'Iterator::rewind' => ['void'],
'Iterator::valid' => ['bool'],
'iterator_apply' => ['int', 'it'=>'Traversable', 'function'=>'callable', 'params='=>'array'],
'iterator_count' => ['int', 'it'=>'Traversable'],
'iterator_to_array' => ['array', 'it'=>'Traversable', 'use_keys='=>'bool'],
'iterator_apply' => ['int', 'iterator'=>'Traversable', 'function'=>'callable', 'params='=>'array'],
'iterator_count' => ['int', 'iterator'=>'Traversable'],
'iterator_to_array' => ['array', 'iterator'=>'Traversable', 'use_keys='=>'bool'],
'IteratorAggregate::getIterator' => ['Traversable'],
'IteratorIterator::__construct' => ['void', 'it'=>'Traversable'],
'IteratorIterator::__construct' => ['void', 'iterator'=>'Traversable'],
'IteratorIterator::current' => ['mixed'],
'IteratorIterator::getInnerIterator' => ['Traversable'],
'IteratorIterator::key' => ['mixed'],
Expand Down Expand Up @@ -7755,7 +7755,7 @@
'ngettext' => ['string', 'msgid1'=>'string', 'msgid2'=>'string', 'n'=>'int'],
'nl2br' => ['string', 'str'=>'string', 'is_xhtml='=>'bool'],
'nl_langinfo' => ['string|false', 'item'=>'int'],
'NoRewindIterator::__construct' => ['void', 'it'=>'iterator'],
'NoRewindIterator::__construct' => ['void', 'iterator'=>'iterator'],
'NoRewindIterator::current' => ['mixed'],
'NoRewindIterator::getInnerIterator' => ['iterator'],
'NoRewindIterator::key' => ['mixed'],
Expand Down Expand Up @@ -8170,7 +8170,7 @@
'overload' => ['', 'class_name'=>'string'],
'override_function' => ['bool', 'function_name'=>'string', 'function_args'=>'string', 'function_code'=>'string'],
'pack' => ['string', 'format'=>'string', '...args='=>'mixed'],
'ParentIterator::__construct' => ['void', 'it'=>'recursiveiterator'],
'ParentIterator::__construct' => ['void', 'iterator'=>'recursiveiterator'],
'ParentIterator::accept' => ['bool'],
'ParentIterator::getChildren' => ['ParentIterator'],
'ParentIterator::hasChildren' => ['bool'],
Expand Down Expand Up @@ -9180,10 +9180,10 @@
'RecursiveArrayIterator::uksort' => ['void', 'cmp_function'=>'callable(mixed,mixed):int'],
'RecursiveArrayIterator::unserialize' => ['string', 'serialized'=>'string'],
'RecursiveArrayIterator::valid' => ['bool'],
'RecursiveCachingIterator::__construct' => ['void', 'it'=>'Iterator', 'flags'=>''],
'RecursiveCachingIterator::__construct' => ['void', 'iterator'=>'Iterator', 'flags'=>''],
'RecursiveCachingIterator::getChildren' => ['RecursiveCachingIterator'],
'RecursiveCachingIterator::hasChildren' => ['bool'],
'RecursiveCallbackFilterIterator::__construct' => ['void', 'it'=>'recursiveiterator', 'func'=>'callable'],
'RecursiveCallbackFilterIterator::__construct' => ['void', 'iterator'=>'recursiveiterator', 'func'=>'callable'],
'RecursiveCallbackFilterIterator::getChildren' => ['RecursiveCallbackFilterIterator'],
'RecursiveCallbackFilterIterator::hasChildren' => ['void'],
'RecursiveDirectoryIterator::__construct' => ['void', 'path'=>'string', 'flags='=>'int'],
Expand All @@ -9194,12 +9194,12 @@
'RecursiveDirectoryIterator::key' => ['string'],
'RecursiveDirectoryIterator::next' => ['void'],
'RecursiveDirectoryIterator::rewind' => ['void'],
'RecursiveFilterIterator::__construct' => ['void', 'it'=>'recursiveiterator'],
'RecursiveFilterIterator::__construct' => ['void', 'iterator'=>'recursiveiterator'],
'RecursiveFilterIterator::getChildren' => ['RecursiveFilterIterator'],
'RecursiveFilterIterator::hasChildren' => ['bool'],
'RecursiveIterator::getChildren' => ['RecursiveIterator'],
'RecursiveIterator::hasChildren' => ['bool'],
'RecursiveIteratorIterator::__construct' => ['void', 'it'=>'RecursiveIterator|IteratorAggregate', 'mode='=>'int', 'flags='=>'int'],
'RecursiveIteratorIterator::__construct' => ['void', 'iterator'=>'RecursiveIterator|IteratorAggregate', 'mode='=>'int', 'flags='=>'int'],
'RecursiveIteratorIterator::beginChildren' => ['void'],
'RecursiveIteratorIterator::beginIteration' => ['RecursiveIterator'],
'RecursiveIteratorIterator::callGetChildren' => ['RecursiveIterator'],
Expand All @@ -9217,10 +9217,10 @@
'RecursiveIteratorIterator::rewind' => ['void'],
'RecursiveIteratorIterator::setMaxDepth' => ['void', 'max_depth='=>'int'],
'RecursiveIteratorIterator::valid' => ['bool'],
'RecursiveRegexIterator::__construct' => ['void', 'it'=>'recursiveiterator', 'regex='=>'string', 'mode='=>'int', 'flags='=>'int', 'preg_flags='=>'int'],
'RecursiveRegexIterator::__construct' => ['void', 'iterator'=>'recursiveiterator', 'regex='=>'string', 'mode='=>'int', 'flags='=>'int', 'preg_flags='=>'int'],
'RecursiveRegexIterator::getChildren' => ['RecursiveRegexIterator'],
'RecursiveRegexIterator::hasChildren' => ['bool'],
'RecursiveTreeIterator::__construct' => ['void', 'it'=>'recursiveiterator|iteratoraggregate', 'flags='=>'int', 'cit_flags='=>'int', 'mode='=>'int'],
'RecursiveTreeIterator::__construct' => ['void', 'iterator'=>'recursiveiterator|iteratoraggregate', 'flags='=>'int', 'cit_flags='=>'int', 'mode='=>'int'],
'RecursiveTreeIterator::beginChildren' => ['void'],
'RecursiveTreeIterator::beginIteration' => ['RecursiveIterator'],
'RecursiveTreeIterator::callGetChildren' => ['RecursiveIterator'],
Expand Down Expand Up @@ -9862,7 +9862,7 @@
'ReflectionZendExtension::getVersion' => ['string'],
'Reflector::__toString' => ['string'],
'Reflector::export' => ['?string'],
'RegexIterator::__construct' => ['void', 'it'=>'iterator', 'regex'=>'string', 'mode='=>'int', 'flags='=>'int', 'preg_flags='=>'int'],
'RegexIterator::__construct' => ['void', 'iterator'=>'iterator', 'regex'=>'string', 'mode='=>'int', 'flags='=>'int', 'preg_flags='=>'int'],
'RegexIterator::accept' => ['bool'],
'RegexIterator::getFlags' => ['int'],
'RegexIterator::getMode' => ['int'],
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Classes/InstantiationRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public function testBug3425(): void
{
$this->analyse([__DIR__ . '/data/bug-3425.php'], [
[
'Parameter #1 $it of class RecursiveIteratorIterator constructor expects T of IteratorAggregate|RecursiveIterator, Generator<int, int, mixed, void> given.',
'Parameter #1 $iterator of class RecursiveIteratorIterator constructor expects T of IteratorAggregate|RecursiveIterator, Generator<int, int, mixed, void> given.',
5,
],
]);
Expand Down

0 comments on commit 72b02a6

Please sign in to comment.