1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Converted ftp functions to use link object instead of a resource

Fixes vimeo/psalm#6403
This commit is contained in:
Bruce Weirdan 2021-09-04 23:39:02 +03:00
parent 5dfd157d72
commit 36dfeed774
No known key found for this signature in database
GPG Key ID: CFC3AAB181751B0D
2 changed files with 183 additions and 40 deletions

View File

@ -3327,42 +3327,42 @@ return [
'fstat' => ['array|false', 'stream'=>'resource'],
'ftell' => ['int|false', 'stream'=>'resource'],
'ftok' => ['int', 'filename'=>'string', 'project_id'=>'string'],
'ftp_alloc' => ['bool', 'ftp'=>'resource', 'size'=>'int', '&w_response='=>'string'],
'ftp_append' => ['bool', 'ftp'=>'resource', 'remote_filename'=>'string', 'local_filename'=>'string', 'mode='=>'int'],
'ftp_cdup' => ['bool', 'ftp'=>'resource'],
'ftp_chdir' => ['bool', 'ftp'=>'resource', 'directory'=>'string'],
'ftp_chmod' => ['int|false', 'ftp'=>'resource', 'permissions'=>'int', 'filename'=>'string'],
'ftp_close' => ['bool', 'ftp'=>'resource'],
'ftp_connect' => ['resource|false', 'hostname'=>'string', 'port='=>'int', 'timeout='=>'int'],
'ftp_delete' => ['bool', 'ftp'=>'resource', 'filename'=>'string'],
'ftp_exec' => ['bool', 'ftp'=>'resource', 'command'=>'string'],
'ftp_fget' => ['bool', 'ftp'=>'resource', 'stream'=>'resource', 'remote_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_fput' => ['bool', 'ftp'=>'resource', 'remote_filename'=>'string', 'stream'=>'resource', 'mode='=>'int', 'offset='=>'int'],
'ftp_get' => ['bool', 'ftp'=>'resource', 'local_filename'=>'string', 'remote_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_get_option' => ['mixed|false', 'ftp'=>'resource', 'option'=>'int'],
'ftp_login' => ['bool', 'ftp'=>'resource', 'username'=>'string', 'password'=>'string'],
'ftp_mdtm' => ['int', 'ftp'=>'resource', 'filename'=>'string'],
'ftp_mkdir' => ['string|false', 'ftp'=>'resource', 'directory'=>'string'],
'ftp_mlsd' => ['array|false', 'ftp'=>'resource', 'directory'=>'string'],
'ftp_nb_continue' => ['int', 'ftp'=>'resource'],
'ftp_nb_fget' => ['int', 'ftp'=>'resource', 'stream'=>'resource', 'remote_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_nb_fput' => ['int', 'ftp'=>'resource', 'remote_filename'=>'string', 'stream'=>'resource', 'mode='=>'int', 'offset='=>'int'],
'ftp_nb_get' => ['int', 'ftp'=>'resource', 'local_filename'=>'string', 'remote_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_nb_put' => ['int', 'ftp'=>'resource', 'remote_filename'=>'string', 'local_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_nlist' => ['array|false', 'ftp'=>'resource', 'directory'=>'string'],
'ftp_pasv' => ['bool', 'ftp'=>'resource', 'enable'=>'bool'],
'ftp_put' => ['bool', 'ftp'=>'resource', 'remote_filename'=>'string', 'local_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_pwd' => ['string|false', 'ftp'=>'resource'],
'ftp_quit' => ['bool', 'ftp'=>'resource'],
'ftp_raw' => ['array', 'ftp'=>'resource', 'command'=>'string'],
'ftp_rawlist' => ['array|false', 'ftp'=>'resource', 'directory'=>'string', 'recursive='=>'bool'],
'ftp_rename' => ['bool', 'ftp'=>'resource', 'from'=>'string', 'to'=>'string'],
'ftp_rmdir' => ['bool', 'ftp'=>'resource', 'directory'=>'string'],
'ftp_set_option' => ['bool', 'ftp'=>'resource', 'option'=>'int', 'value'=>'mixed'],
'ftp_site' => ['bool', 'ftp'=>'resource', 'command'=>'string'],
'ftp_size' => ['int', 'ftp'=>'resource', 'filename'=>'string'],
'ftp_ssl_connect' => ['resource|false', 'hostname'=>'string', 'port='=>'int', 'timeout='=>'int'],
'ftp_systype' => ['string|false', 'ftp'=>'resource'],
'ftp_alloc' => ['bool', 'ftp'=>'FTP\Connection', 'size'=>'int', '&w_response='=>'string'],
'ftp_append' => ['bool', 'ftp'=>'FTP\Connection', 'remote_filename'=>'string', 'local_filename'=>'string', 'mode='=>'int'],
'ftp_cdup' => ['bool', 'ftp'=>'FTP\Connection'],
'ftp_chdir' => ['bool', 'ftp'=>'FTP\Connection', 'directory'=>'string'],
'ftp_chmod' => ['int|false', 'ftp'=>'FTP\Connection', 'permissions'=>'int', 'filename'=>'string'],
'ftp_close' => ['bool', 'ftp'=>'FTP\Connection'],
'ftp_connect' => ['FTP\Connection|false', 'hostname'=>'string', 'port='=>'int', 'timeout='=>'int'],
'ftp_delete' => ['bool', 'ftp'=>'FTP\Connection', 'filename'=>'string'],
'ftp_exec' => ['bool', 'ftp'=>'FTP\Connection', 'command'=>'string'],
'ftp_fget' => ['bool', 'ftp'=>'FTP\Connection', 'stream'=>'FTP\Connection', 'remote_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_fput' => ['bool', 'ftp'=>'FTP\Connection', 'remote_filename'=>'string', 'stream'=>'FTP\Connection', 'mode='=>'int', 'offset='=>'int'],
'ftp_get' => ['bool', 'ftp'=>'FTP\Connection', 'local_filename'=>'string', 'remote_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_get_option' => ['mixed|false', 'ftp'=>'FTP\Connection', 'option'=>'int'],
'ftp_login' => ['bool', 'ftp'=>'FTP\Connection', 'username'=>'string', 'password'=>'string'],
'ftp_mdtm' => ['int', 'ftp'=>'FTP\Connection', 'filename'=>'string'],
'ftp_mkdir' => ['string|false', 'ftp'=>'FTP\Connection', 'directory'=>'string'],
'ftp_mlsd' => ['array|false', 'ftp'=>'FTP\Connection', 'directory'=>'string'],
'ftp_nb_continue' => ['int', 'ftp'=>'FTP\Connection'],
'ftp_nb_fget' => ['int', 'ftp'=>'FTP\Connection', 'stream'=>'FTP\Connection', 'remote_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_nb_fput' => ['int', 'ftp'=>'FTP\Connection', 'remote_filename'=>'string', 'stream'=>'FTP\Connection', 'mode='=>'int', 'offset='=>'int'],
'ftp_nb_get' => ['int', 'ftp'=>'FTP\Connection', 'local_filename'=>'string', 'remote_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_nb_put' => ['int', 'ftp'=>'FTP\Connection', 'remote_filename'=>'string', 'local_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_nlist' => ['array|false', 'ftp'=>'FTP\Connection', 'directory'=>'string'],
'ftp_pasv' => ['bool', 'ftp'=>'FTP\Connection', 'enable'=>'bool'],
'ftp_put' => ['bool', 'ftp'=>'FTP\Connection', 'remote_filename'=>'string', 'local_filename'=>'string', 'mode='=>'int', 'offset='=>'int'],
'ftp_pwd' => ['string|false', 'ftp'=>'FTP\Connection'],
'ftp_quit' => ['bool', 'ftp'=>'FTP\Connection'],
'ftp_raw' => ['array', 'ftp'=>'FTP\Connection', 'command'=>'string'],
'ftp_rawlist' => ['array|false', 'ftp'=>'FTP\Connection', 'directory'=>'string', 'recursive='=>'bool'],
'ftp_rename' => ['bool', 'ftp'=>'FTP\Connection', 'from'=>'string', 'to'=>'string'],
'ftp_rmdir' => ['bool', 'ftp'=>'FTP\Connection', 'directory'=>'string'],
'ftp_set_option' => ['bool', 'ftp'=>'FTP\Connection', 'option'=>'int', 'value'=>'mixed'],
'ftp_site' => ['bool', 'ftp'=>'FTP\Connection', 'command'=>'string'],
'ftp_size' => ['int', 'ftp'=>'FTP\Connection', 'filename'=>'string'],
'ftp_ssl_connect' => ['FTP\Connection|false', 'hostname'=>'string', 'port='=>'int', 'timeout='=>'int'],
'ftp_systype' => ['string|false', 'ftp'=>'FTP\Connection'],
'ftruncate' => ['bool', 'stream'=>'resource', 'size'=>'int'],
'func_get_arg' => ['mixed|false', 'position'=>'int'],
'func_get_args' => ['list<mixed>'],

View File

@ -16,12 +16,155 @@
*/
return [
'added' => [
'array_is_list' => ['bool', 'array'=>'array'],
'array_is_list' => ['bool', 'array' => 'array'],
],
'changed' => [
'ftp_connect' => [
'old' => ['resource|false', 'hostname' => 'string', 'port=' => 'int', 'timeout=' => 'int'],
'new' => ['FTP\Connection|false', 'hostname' => 'string', 'port=' => 'int', 'timeout=' => 'int'],
],
'ftp_ssl_connect' => [
'old' => ['resource|false', 'hostname' => 'string', 'port=' => 'int', 'timeout=' => 'int'],
'new' => ['FTP\Connection|false', 'hostname' => 'string', 'port=' => 'int', 'timeout=' => 'int'],
],
'ftp_login' => [
'old' => ['bool', 'ftp' => 'resource', 'username' => 'string', 'password' => 'string'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'username' => 'string', 'password' => 'string'],
],
'ftp_pwd' => [
'old' => ['string|false', 'ftp' => 'resource'],
'new' => ['string|false', 'ftp' => 'FTP\Connection'],
],
'ftp_cdup' => [
'old' => ['bool', 'ftp' => 'resource'],
'new' => ['bool', 'ftp' => 'FTP\Connection'],
],
'ftp_chdir' => [
'old' => ['bool', 'ftp' => 'resource', 'directory' => 'string'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'directory' => 'string'],
],
'ftp_exec' => [
'old' => ['bool', 'ftp' => 'resource', 'command' => 'string'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'command' => 'string'],
],
'ftp_raw' => [
'old' => ['array', 'ftp' => 'resource', 'command' => 'string'],
'new' => ['array', 'ftp' => 'FTP\Connection', 'command' => 'string'],
],
'ftp_mkdir' => [
'old' => ['string|false', 'ftp' => 'resource', 'directory' => 'string'],
'new' => ['string|false', 'ftp' => 'FTP\Connection', 'directory' => 'string'],
],
'ftp_rmdir' => [
'old' => ['bool', 'ftp' => 'resource', 'directory' => 'string'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'directory' => 'string'],
],
'ftp_chmod' => [
'old' => ['int|false', 'ftp' => 'resource', 'permissions' => 'int', 'filename' => 'string'],
'new' => ['int|false', 'ftp' => 'FTP\Connection', 'permissions' => 'int', 'filename' => 'string'],
],
'ftp_alloc' => [
'old' => ['bool', 'ftp' => 'resource', 'size' => 'int', '&w_response=' => 'string'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'size' => 'int', '&w_response=' => 'string'],
],
'ftp_nlist' => [
'old' => ['array|false', 'ftp' => 'resource', 'directory' => 'string'],
'new' => ['array|false', 'ftp' => 'FTP\Connection', 'directory' => 'string'],
],
'ftp_rawlist' => [
'old' => ['array|false', 'ftp' => 'resource', 'directory' => 'string', 'recursive=' => 'bool'],
'new' => ['array|false', 'ftp' => 'FTP\Connection', 'directory' => 'string', 'recursive=' => 'bool'],
],
'ftp_mlsd' => [
'old' => ['array|false', 'ftp' => 'resource', 'directory' => 'string'],
'new' => ['array|false', 'ftp' => 'FTP\Connection', 'directory' => 'string'],
],
'ftp_systype' => [
'old' => ['string|false', 'ftp' => 'resource'],
'new' => ['string|false', 'ftp' => 'FTP\Connection'],
],
'ftp_fget' => [
'old' => ['bool', 'ftp' => 'resource', 'stream' => 'resource', 'remote_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'stream' => 'FTP\Connection', 'remote_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
],
'ftp_nb_fget' => [
'old' => ['int', 'ftp' => 'resource', 'stream' => 'resource', 'remote_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
'new' => ['int', 'ftp' => 'FTP\Connection', 'stream' => 'FTP\Connection', 'remote_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
],
'ftp_pasv' => [
'old' => ['bool', 'ftp' => 'resource', 'enable' => 'bool'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'enable' => 'bool'],
],
'ftp_get' => [
'old' => ['bool', 'ftp' => 'resource', 'local_filename' => 'string', 'remote_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'local_filename' => 'string', 'remote_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
],
'ftp_nb_get' => [
'old' => ['int', 'ftp' => 'resource', 'local_filename' => 'string', 'remote_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
'new' => ['int', 'ftp' => 'FTP\Connection', 'local_filename' => 'string', 'remote_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
],
'ftp_nb_continue' => [
'old' => ['int', 'ftp' => 'resource'],
'new' => ['int', 'ftp' => 'FTP\Connection'],
],
'ftp_fput' => [
'old' => ['bool', 'ftp' => 'resource', 'remote_filename' => 'string', 'stream' => 'resource', 'mode=' => 'int', 'offset=' => 'int'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'remote_filename' => 'string', 'stream' => 'FTP\Connection', 'mode=' => 'int', 'offset=' => 'int'],
],
'ftp_nb_fput' => [
'old' => ['int', 'ftp' => 'resource', 'remote_filename' => 'string', 'stream' => 'resource', 'mode=' => 'int', 'offset=' => 'int'],
'new' => ['int', 'ftp' => 'FTP\Connection', 'remote_filename' => 'string', 'stream' => 'FTP\Connection', 'mode=' => 'int', 'offset=' => 'int'],
],
'ftp_put' => [
'old' => ['bool', 'ftp' => 'resource', 'remote_filename' => 'string', 'local_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'remote_filename' => 'string', 'local_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
],
'ftp_append' => [
'old' => ['bool', 'ftp' => 'resource', 'remote_filename' => 'string', 'local_filename' => 'string', 'mode=' => 'int'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'remote_filename' => 'string', 'local_filename' => 'string', 'mode=' => 'int'],
],
'ftp_nb_put' => [
'old' => ['int', 'ftp' => 'resource', 'remote_filename' => 'string', 'local_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
'new' => ['int', 'ftp' => 'FTP\Connection', 'remote_filename' => 'string', 'local_filename' => 'string', 'mode=' => 'int', 'offset=' => 'int'],
],
'ftp_size' => [
'old' => ['int', 'ftp' => 'resource', 'filename' => 'string'],
'new' => ['int', 'ftp' => 'FTP\Connection', 'filename' => 'string'],
],
'ftp_mdtm' => [
'old' => ['int', 'ftp' => 'resource', 'filename' => 'string'],
'new' => ['int', 'ftp' => 'FTP\Connection', 'filename' => 'string'],
],
'ftp_rename' => [
'old' => ['bool', 'ftp' => 'resource', 'from' => 'string', 'to' => 'string'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'from' => 'string', 'to' => 'string'],
],
'ftp_delete' => [
'old' => ['bool', 'ftp' => 'resource', 'filename' => 'string'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'filename' => 'string'],
],
'ftp_site' => [
'old' => ['bool', 'ftp' => 'resource', 'command' => 'string'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'command' => 'string'],
],
'ftp_close' => [
'old' => ['bool', 'ftp' => 'resource'],
'new' => ['bool', 'ftp' => 'FTP\Connection'],
],
'ftp_quit' => [
'old' => ['bool', 'ftp' => 'resource'],
'new' => ['bool', 'ftp' => 'FTP\Connection'],
],
'ftp_set_option' => [
'old' => ['bool', 'ftp' => 'resource', 'option' => 'int', 'value' => 'mixed'],
'new' => ['bool', 'ftp' => 'FTP\Connection', 'option' => 'int', 'value' => 'mixed'],
],
'ftp_get_option' => [
'old' => ['mixed|false', 'ftp' => 'resource', 'option' => 'int'],
'new' => ['mixed|false', 'ftp' => 'FTP\Connection', 'option' => 'int'],
],
],
'removed' => [
],
'removed' => [],
];