1
0
mirror of https://github.com/Ne-Lexa/php-zip.git synced 2025-10-10 12:54:29 +02:00

added static analysis

This commit is contained in:
Ne-Lexa
2021-02-23 19:44:48 +03:00
parent a85288d34b
commit 00dd097b2d
21 changed files with 84 additions and 86 deletions

View File

@@ -99,6 +99,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
throw new ZipException("File {$filename} does not exist.");
}
/** @psalm-suppress InvalidArgument */
set_error_handler(
static function (int $errorNumber, string $errorString): ?bool {
throw new InvalidArgumentException($errorString, $errorNumber);
@@ -417,6 +418,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
continue;
}
/** @psalm-suppress InvalidArgument */
set_error_handler(
static function (int $errorNumber, string $errorString) use ($entry, $file): ?bool {
throw new ZipException(
@@ -1454,6 +1456,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
{
$tempFilename = $filename . '.temp' . uniqid('', false);
/** @psalm-suppress InvalidArgument */
set_error_handler(
static function (int $errorNumber, string $errorString): ?bool {
throw new InvalidArgumentException($errorString, $errorNumber);
@@ -1479,7 +1482,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
}
}
if (!@rename($tempFilename, $filename)) {
if (!rename($tempFilename, $filename)) {
if (is_file($tempFilename)) {
unlink($tempFilename);
}