diff --git a/resources/functionMap.php b/resources/functionMap.php index 6923ba01c4..ad1e45d53f 100644 --- a/resources/functionMap.php +++ b/resources/functionMap.php @@ -125,14 +125,6 @@ 'apc_store' => ['bool', 'key'=>'string', 'var'=>'', 'ttl='=>'int'], 'apc_store\'1' => ['array', 'values'=>'array', 'unused='=>'', 'ttl='=>'int'], 'APCIterator::__construct' => ['void', 'cache'=>'string', 'search='=>'', 'format='=>'int', 'chunk_size='=>'int', 'list='=>'int'], -'APCIterator::current' => ['mixed'], -'APCIterator::getTotalCount' => ['int'], -'APCIterator::getTotalHits' => ['int'], -'APCIterator::getTotalSize' => ['int'], -'APCIterator::key' => ['string'], -'APCIterator::next' => ['void'], -'APCIterator::rewind' => ['void'], -'APCIterator::valid' => ['bool'], 'apcu_add' => ['bool', 'key'=>'string', 'var'=>'', 'ttl='=>'int'], 'apcu_add\'1' => ['array', 'values'=>'array', 'unused='=>'', 'ttl='=>'int'], 'apcu_cache_info' => ['__benevolent|false>', 'limited='=>'bool'], @@ -150,14 +142,6 @@ 'apcu_store' => ['bool', 'key'=>'string', 'var='=>'', 'ttl='=>'int'], 'apcu_store\'1' => ['array', 'values'=>'array', 'unused='=>'', 'ttl='=>'int'], 'APCuIterator::__construct' => ['void', 'search='=>'string|string[]|null', 'format='=>'int', 'chunk_size='=>'int', 'list='=>'int'], -'APCuIterator::current' => ['mixed'], -'APCuIterator::getTotalCount' => ['int'], -'APCuIterator::getTotalHits' => ['int'], -'APCuIterator::getTotalSize' => ['int'], -'APCuIterator::key' => ['string'], -'APCuIterator::next' => ['void'], -'APCuIterator::rewind' => ['void'], -'APCuIterator::valid' => ['bool'], 'apd_breakpoint' => ['bool', 'debug_level'=>'int'], 'apd_callstack' => ['array'], 'apd_clunk' => ['void', 'warning'=>'string', 'delimiter='=>'string'], @@ -172,16 +156,6 @@ 'apd_set_session' => ['void', 'debug_level'=>'int'], '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', 'iterator'=>'Iterator'], -'AppendIterator::current' => ['mixed'], -'AppendIterator::getArrayIterator' => ['ArrayIterator'], -'AppendIterator::getInnerIterator' => ['iterator'], -'AppendIterator::getIteratorIndex' => ['int'], -'AppendIterator::key' => ['mixed'], -'AppendIterator::next' => ['void'], -'AppendIterator::rewind' => ['void'], -'AppendIterator::valid' => ['bool'], 'array_change_key_case' => ['array', 'input'=>'array', 'case='=>'int'], 'array_chunk' => ['list', 'input'=>'array', 'size'=>'positive-int', 'preserve_keys='=>'bool'], 'array_column' => ['array', 'array'=>'array', 'column_key'=>'mixed', 'index_key='=>'mixed'], @@ -849,14 +823,6 @@ 'call_user_func_array' => ['mixed', 'function'=>'callable', 'parameters'=>'array'], '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'], -'CallbackFilterIterator::__construct' => ['void', 'iterator'=>'Iterator', 'func'=>'callable'], -'CallbackFilterIterator::accept' => ['bool'], -'CallbackFilterIterator::current' => ['mixed'], -'CallbackFilterIterator::getInnerIterator' => ['Iterator'], -'CallbackFilterIterator::key' => ['mixed'], -'CallbackFilterIterator::next' => ['void'], -'CallbackFilterIterator::rewind' => ['void'], -'CallbackFilterIterator::valid' => ['bool'], 'ceil' => ['__benevolent', 'number'=>'float'], 'chdb::__construct' => ['void', 'pathname'=>'string'], 'chdb::get' => ['string', 'key'=>'string'], @@ -1447,43 +1413,6 @@ 'Directory::close' => ['void', 'dir_handle='=>'resource'], 'Directory::read' => ['string|false', 'dir_handle='=>'resource'], 'Directory::rewind' => ['void', 'dir_handle='=>'resource'], -'DirectoryIterator::__construct' => ['void', 'path'=>'string'], -'DirectoryIterator::__toString' => ['string'], -'DirectoryIterator::current' => ['DirectoryIterator'], -'DirectoryIterator::getATime' => ['int'], -'DirectoryIterator::getBasename' => ['string', 'suffix='=>'string'], -'DirectoryIterator::getChildren' => ['RecursiveDirectoryIterator'], -'DirectoryIterator::getCTime' => ['int'], -'DirectoryIterator::getExtension' => ['string'], -'DirectoryIterator::getFileInfo' => ['SplFileInfo', 'class_name='=>'string'], -'DirectoryIterator::getFilename' => ['string'], -'DirectoryIterator::getGroup' => ['int'], -'DirectoryIterator::getInode' => ['int'], -'DirectoryIterator::getLinkTarget' => ['string'], -'DirectoryIterator::getMTime' => ['int'], -'DirectoryIterator::getOwner' => ['int'], -'DirectoryIterator::getPath' => ['string'], -'DirectoryIterator::getPathInfo' => ['SplFileInfo', 'class_name='=>'string'], -'DirectoryIterator::getPathname' => ['string'], -'DirectoryIterator::getPerms' => ['int'], -'DirectoryIterator::getRealPath' => ['string'], -'DirectoryIterator::getSize' => ['int'], -'DirectoryIterator::getType' => ['string'], -'DirectoryIterator::isDir' => ['bool'], -'DirectoryIterator::isDot' => ['bool'], -'DirectoryIterator::isExecutable' => ['bool'], -'DirectoryIterator::isFile' => ['bool'], -'DirectoryIterator::isLink' => ['bool'], -'DirectoryIterator::isReadable' => ['bool'], -'DirectoryIterator::isWritable' => ['bool'], -'DirectoryIterator::key' => ['string'], -'DirectoryIterator::next' => ['void'], -'DirectoryIterator::openFile' => ['SplFileObject', 'mode='=>'string', 'use_include_path='=>'bool', 'context='=>'resource'], -'DirectoryIterator::rewind' => ['void'], -'DirectoryIterator::seek' => ['void', 'position'=>'int'], -'DirectoryIterator::setFileClass' => ['void', 'class_name='=>'string'], -'DirectoryIterator::setInfoClass' => ['void', 'class_name='=>'string'], -'DirectoryIterator::valid' => ['bool'], 'dirname' => ['string', 'path'=>'string', 'levels='=>'positive-int'], 'disk_free_space' => ['float|false', 'path'=>'string'], 'disk_total_space' => ['float|false', 'path'=>'string'], @@ -1752,11 +1681,6 @@ 'eio_unlink' => ['resource|false', 'path'=>'string', 'pri='=>'int', 'callback='=>'callable', 'data='=>'mixed'], 'eio_utime' => ['resource|false', 'path'=>'string', 'atime'=>'float', 'mtime'=>'float', 'pri='=>'int', 'callback='=>'callable', 'data='=>'mixed'], 'eio_write' => ['resource|false', 'fd'=>'mixed', 'str'=>'string', 'length='=>'int', 'offset='=>'int', 'pri='=>'int', 'callback='=>'callable', 'data='=>'mixed'], -'EmptyIterator::current' => ['mixed'], -'EmptyIterator::key' => ['mixed'], -'EmptyIterator::next' => ['void'], -'EmptyIterator::rewind' => ['void'], -'EmptyIterator::valid' => ['bool'], 'enchant_broker_describe' => ['array', 'broker'=>'resource'], 'enchant_broker_dict_exists' => ['bool', 'broker'=>'resource', 'tag'=>'string'], 'enchant_broker_free' => ['bool', 'broker'=>'resource'], @@ -2415,13 +2339,6 @@ 'filepro_retrieve' => ['string', 'row_number'=>'int', 'field_number'=>'int'], 'filepro_rowcount' => ['int'], 'filesize' => ['0|positive-int|false', 'filename'=>'string'], -'FilesystemIterator::__construct' => ['void', 'path'=>'string', 'flags='=>'int'], -'FilesystemIterator::current' => ['string|SplFileInfo'], -'FilesystemIterator::getFlags' => ['int'], -'FilesystemIterator::key' => ['string'], -'FilesystemIterator::next' => ['void'], -'FilesystemIterator::rewind' => ['void'], -'FilesystemIterator::setFlags' => ['void', 'flags='=>'int'], 'filetype' => ['string|false', 'filename'=>'string'], 'filter_has_var' => ['bool', 'type'=>'int', 'variable_name'=>'string'], 'filter_id' => ['int|false', 'filtername'=>'string'], @@ -2430,14 +2347,6 @@ 'filter_list' => ['non-empty-list'], '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', 'iterator'=>'Iterator'], -'FilterIterator::accept' => ['bool'], -'FilterIterator::current' => ['mixed'], -'FilterIterator::getInnerIterator' => ['Iterator'], -'FilterIterator::key' => ['mixed'], -'FilterIterator::next' => ['void'], -'FilterIterator::rewind' => ['void'], -'FilterIterator::valid' => ['bool'], 'finfo::__construct' => ['void', 'options='=>'int', 'magic_file='=>'string'], 'finfo::finfo' => ['void', 'options='=>'int', 'magic_file='=>'string'], 'finfo::buffer' => ['string|false', 'string'=>'string', 'options='=>'int', 'context='=>'resource'], @@ -2809,9 +2718,6 @@ 'gettimeofday' => ['array|float', 'get_as_float='=>'bool'], 'gettype' => ['string', 'var'=>'mixed'], 'glob' => ['list|false', 'pattern'=>'string', 'flags='=>'int'], -'GlobIterator::__construct' => ['void', 'path'=>'string', 'flags='=>'int'], -'GlobIterator::cont' => ['int'], -'GlobIterator::count' => ['0|positive-int'], 'Gmagick::__construct' => ['void', 'filename='=>'string'], 'Gmagick::addimage' => ['Gmagick', 'gmagick'=>'gmagick'], 'Gmagick::addnoiseimage' => ['Gmagick', 'noise'=>'int'], @@ -4643,27 +4549,6 @@ 'ImagickPixel::setColorValueQuantum' => ['void', 'color'=>'int', 'value'=>'mixed'], 'ImagickPixel::setHSL' => ['bool', 'hue'=>'float', 'saturation'=>'float', 'luminosity'=>'float'], 'ImagickPixel::setIndex' => ['void', 'index'=>'int'], -'ImagickPixelIterator::__construct' => ['void', 'wand'=>'imagick'], -'ImagickPixelIterator::clear' => ['bool'], -'ImagickPixelIterator::current' => ['mixed'], -'ImagickPixelIterator::destroy' => ['bool'], -'ImagickPixelIterator::getCurrentIteratorRow' => ['array'], -'ImagickPixelIterator::getIteratorRow' => ['int'], -'ImagickPixelIterator::getNextIteratorRow' => ['array'], -'ImagickPixelIterator::getpixeliterator' => ['', 'Imagick'=>'Imagick'], -'ImagickPixelIterator::getpixelregioniterator' => ['', 'Imagick'=>'Imagick', 'x'=>'', 'y'=>'', 'columns'=>'', 'rows'=>''], -'ImagickPixelIterator::getPreviousIteratorRow' => ['array'], -'ImagickPixelIterator::key' => ['int|string'], -'ImagickPixelIterator::newPixelIterator' => ['bool', 'wand'=>'imagick'], -'ImagickPixelIterator::newPixelRegionIterator' => ['bool', 'wand'=>'imagick', 'x'=>'int', 'y'=>'int', 'columns'=>'int', 'rows'=>'int'], -'ImagickPixelIterator::next' => ['void'], -'ImagickPixelIterator::resetIterator' => ['bool'], -'ImagickPixelIterator::rewind' => ['void'], -'ImagickPixelIterator::setIteratorFirstRow' => ['bool'], -'ImagickPixelIterator::setIteratorLastRow' => ['bool'], -'ImagickPixelIterator::setIteratorRow' => ['bool', 'row'=>'int'], -'ImagickPixelIterator::syncIterator' => ['bool'], -'ImagickPixelIterator::valid' => ['bool'], 'imap_8bit' => ['string|false', 'text'=>'string'], 'imap_alerts' => ['array|false'], 'imap_append' => ['bool', 'stream_id'=>'resource', 'folder'=>'string', 'message'=>'string', 'options='=>'string', 'internal_date='=>'string'], @@ -4747,8 +4632,6 @@ 'inclued_get_data' => ['array'], 'inet_ntop' => ['string|false', 'in_addr'=>'string'], 'inet_pton' => ['string|false', 'ip_address'=>'string'], -'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'], 'inflate_get_status' => ['int|false', 'resource'=>'resource'], @@ -5121,22 +5004,10 @@ 'is_uploaded_file' => ['bool', 'path'=>'string'], 'is_writable' => ['bool', 'filename'=>'string'], 'is_writeable' => ['bool', 'filename'=>'string'], -'Iterator::current' => ['mixed'], -'Iterator::key' => ['mixed'], -'Iterator::next' => ['void'], -'Iterator::rewind' => ['void'], -'Iterator::valid' => ['bool'], 'iterator_apply' => ['0|positive-int', 'iterator'=>'Traversable', 'function'=>'callable', 'params='=>'array'], 'iterator_count' => ['0|positive-int', 'iterator'=>'Traversable'], 'iterator_to_array' => ['array', 'iterator'=>'Traversable', 'use_keys='=>'bool'], 'IteratorAggregate::getIterator' => ['Traversable'], -'IteratorIterator::__construct' => ['void', 'iterator'=>'Traversable'], -'IteratorIterator::current' => ['mixed'], -'IteratorIterator::getInnerIterator' => ['Traversable'], -'IteratorIterator::key' => ['mixed'], -'IteratorIterator::next' => ['void'], -'IteratorIterator::rewind' => ['void'], -'IteratorIterator::valid' => ['bool'], 'java_last_exception_clear' => [''], 'java_last_exception_get' => ['object'], 'java_reload' => ['array', 'new_jarpath'=>'new_jarpath'], @@ -5392,15 +5263,6 @@ 'libxml_set_external_entity_loader' => ['bool', 'resolver_function'=>'callable'], 'libxml_set_streams_context' => ['void', 'streams_context'=>'resource'], 'libxml_use_internal_errors' => ['bool', 'use_errors='=>'bool'], -'LimitIterator::__construct' => ['void', 'iterator'=>'Iterator', 'offset='=>'int', 'count='=>'int'], -'LimitIterator::current' => ['mixed'], -'LimitIterator::getInnerIterator' => ['Iterator'], -'LimitIterator::getPosition' => ['int'], -'LimitIterator::key' => ['mixed'], -'LimitIterator::next' => ['void'], -'LimitIterator::rewind' => ['void'], -'LimitIterator::seek' => ['int', 'position'=>'int'], -'LimitIterator::valid' => ['bool'], 'lineObj::__construct' => ['void'], 'lineObj::add' => ['int', 'point'=>'pointObj'], 'lineObj::addXY' => ['int', 'x'=>'float', 'y'=>'float', 'm'=>'float'], @@ -6452,18 +6314,6 @@ 'mt_rand' => ['int', 'min'=>'int', 'max'=>'int'], 'mt_rand\'1' => ['int'], 'mt_srand' => ['void', 'seed='=>'int', 'mode='=>'int'], -'MultipleIterator::__construct' => ['void', 'flags='=>'int'], -'MultipleIterator::attachIterator' => ['void', 'iterator'=>'Iterator', 'infos='=>'string'], -'MultipleIterator::containsIterator' => ['bool', 'iterator'=>'Iterator'], -'MultipleIterator::countIterators' => ['int'], -'MultipleIterator::current' => ['array'], -'MultipleIterator::detachIterator' => ['void', 'iterator'=>'Iterator'], -'MultipleIterator::getFlags' => ['int'], -'MultipleIterator::key' => ['array'], -'MultipleIterator::next' => ['void'], -'MultipleIterator::rewind' => ['void'], -'MultipleIterator::setFlags' => ['int', 'flags'=>'int'], -'MultipleIterator::valid' => ['bool'], 'mysql_affected_rows' => ['int', 'link_identifier='=>'resource'], 'mysql_client_encoding' => ['string', 'link_identifier='=>'resource'], 'mysql_close' => ['bool', 'link_identifier='=>'resource'], @@ -7102,13 +6952,6 @@ 'ngettext' => ['string', 'msgid1'=>'string', 'msgid2'=>'string', 'n'=>'int'], 'nl2br' => ['string', 'str'=>'string', 'is_xhtml='=>'bool'], 'nl_langinfo' => ['string|false', 'item'=>'int'], -'NoRewindIterator::__construct' => ['void', 'iterator'=>'Iterator'], -'NoRewindIterator::current' => ['mixed'], -'NoRewindIterator::getInnerIterator' => ['Iterator'], -'NoRewindIterator::key' => ['mixed'], -'NoRewindIterator::next' => ['void'], -'NoRewindIterator::rewind' => ['void'], -'NoRewindIterator::valid' => ['bool'], 'Normalizer::getRawDecomposition' => ['string|null', 'input'=>'string'], 'Normalizer::isNormalized' => ['bool', 'input'=>'string', 'form='=>'int'], 'Normalizer::normalize' => ['string|false', 'input'=>'string', 'form='=>'int'], @@ -7516,13 +7359,6 @@ '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', 'iterator'=>'RecursiveIterator'], -'ParentIterator::accept' => ['bool'], -'ParentIterator::getChildren' => ['ParentIterator'], -'ParentIterator::hasChildren' => ['bool'], -'ParentIterator::next' => ['void'], -'ParentIterator::rewind' => ['void'], -'ParentIterator::valid' => [''], 'Parle\Lexer::advance' => ['void'], 'Parle\Lexer::build' => ['void'], 'Parle\Lexer::callout' => ['void', 'id'=>'int', 'callback'=>'callable'], @@ -9255,15 +9091,6 @@ 'ReflectionZendExtension::getVersion' => ['string'], 'Reflector::__toString' => ['string'], 'Reflector::export' => ['?string'], -'RegexIterator::__construct' => ['void', 'iterator'=>'Iterator', 'regex'=>'string', 'mode='=>'int', 'flags='=>'int', 'preg_flags='=>'int'], -'RegexIterator::accept' => ['bool'], -'RegexIterator::getFlags' => ['int'], -'RegexIterator::getMode' => ['int'], -'RegexIterator::getPregFlags' => ['int'], -'RegexIterator::getRegex' => ['string'], -'RegexIterator::setFlags' => ['bool', 'new_flags'=>'int'], -'RegexIterator::setMode' => ['bool', 'new_mode'=>'int'], -'RegexIterator::setPregFlags' => ['bool', 'new_flags'=>'int'], 'register_event_handler' => ['bool', 'event_handler_func'=>'event_handler_func', 'handler_register_name'=>'handler_register_name', 'event_type_mask'=>'event_type_mask'], 'register_shutdown_function' => ['void', 'function'=>'callable', '...parameter='=>'mixed'], 'register_tick_function' => ['bool', 'function'=>'callable(): void', '...args='=>'mixed'], @@ -9631,13 +9458,6 @@ 'SimpleXMLElement::getNamespaces' => ['string[]', 'recursive='=>'bool'], 'SimpleXMLElement::registerXPathNamespace' => ['bool', 'prefix'=>'string', 'ns'=>'string'], 'SimpleXMLElement::xpath' => ['static[]|false|null', 'path'=>'string'], -'SimpleXMLIterator::current' => ['SimpleXMLIterator'], -'SimpleXMLIterator::getChildren' => ['SimpleXMLIterator'], -'SimpleXMLIterator::hasChildren' => ['bool'], -'SimpleXMLIterator::key' => ['string|false'], -'SimpleXMLIterator::next' => ['void'], -'SimpleXMLIterator::rewind' => ['void'], -'SimpleXMLIterator::valid' => ['bool'], 'sin' => ['float', 'number'=>'float'], 'sinh' => ['float', 'number'=>'float'], 'sizeof' => ['int', 'var'=>'Countable|array', 'mode='=>'int'], @@ -11743,12 +11563,6 @@ 'TokyoTyrant::sync' => ['mixed'], 'TokyoTyrant::tune' => ['TokyoTyrant', 'timeout'=>'float', 'options='=>'int'], 'TokyoTyrant::vanish' => ['mixed'], -'TokyoTyrantIterator::__construct' => ['void', 'object'=>'mixed'], -'TokyoTyrantIterator::current' => ['mixed'], -'TokyoTyrantIterator::key' => ['mixed'], -'TokyoTyrantIterator::next' => ['mixed'], -'TokyoTyrantIterator::rewind' => ['void'], -'TokyoTyrantIterator::valid' => ['bool'], 'TokyoTyrantQuery::__construct' => ['void', 'table'=>'TokyoTyrantTable'], 'TokyoTyrantQuery::addCond' => ['mixed', 'name'=>'string', 'op'=>'int', 'expr'=>'string'], 'TokyoTyrantQuery::count' => ['0|positive-int'], diff --git a/tests/PHPStan/Rules/Methods/data/bug-7519.php b/tests/PHPStan/Rules/Methods/data/bug-7519.php index c1020b84f8..687879a887 100644 --- a/tests/PHPStan/Rules/Methods/data/bug-7519.php +++ b/tests/PHPStan/Rules/Methods/data/bug-7519.php @@ -7,7 +7,7 @@ /** * @template TKey * @template T - * @template TIterator as Iterator + * @template TIterator as \Iterator * * @extends FilterIterator */