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

Fix return type of \zip_open() (#3046)

This function can return an int [0] or false [1] in case of error.

The return value of ZipArchive has also been fixed, it returns either a
boolean or an int [2][3].

Close vimeo/psalm#3209.

[0] https://github.com/php/php-src/blob/php-7.4.4/ext/zip/php_zip.c#L1176
[1] https://github.com/php/php-src/blob/php-7.4.4/ext/zip/php_zip.c#L1160
[3] https://github.com/php/php-src/blob/php-7.4.4/ext/zip/php_zip.c#L1483
[4] https://github.com/php/php-src/blob/php-7.4.4/ext/zip/php_zip.c#L1478
This commit is contained in:
LeSuisse 2020-04-01 23:12:45 +02:00 committed by GitHub
parent fa43d3a8ff
commit 3ecd6bbd00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16518,7 +16518,7 @@ return [
'zip_entry_name' => ['string', 'zip_entry'=>'resource'],
'zip_entry_open' => ['bool', 'zip_dp'=>'resource', 'zip_entry'=>'resource', 'mode='=>'string'],
'zip_entry_read' => ['string|false', 'zip_entry'=>'resource', 'len='=>'int'],
'zip_open' => ['resource', 'filename'=>'string'],
'zip_open' => ['resource|int|false', 'filename'=>'string'],
'zip_read' => ['resource', 'zip'=>'resource'],
'ZipArchive::addEmptyDir' => ['bool', 'dirname'=>'string'],
'ZipArchive::addFile' => ['bool', 'filepath'=>'string', 'entryname='=>'string', 'start='=>'int', 'length='=>'int'],
@ -16542,7 +16542,7 @@ return [
'ZipArchive::getStatusString' => ['string|false'],
'ZipArchive::getStream' => ['resource|false', 'entryname'=>'string'],
'ZipArchive::locateName' => ['int|false', 'filename'=>'string', 'flags='=>'int'],
'ZipArchive::open' => ['mixed', 'source'=>'string', 'flags='=>'int'],
'ZipArchive::open' => ['resource|int|false', 'source'=>'string', 'flags='=>'int'],
'ZipArchive::renameIndex' => ['bool', 'index'=>'int', 'new_name'=>'string'],
'ZipArchive::renameName' => ['bool', 'name'=>'string', 'new_name'=>'string'],
'ZipArchive::setArchiveComment' => ['bool', 'comment'=>'string'],