diff --git a/.php_cs b/.php_cs index 976ecbf..520825d 100644 --- a/.php_cs +++ b/.php_cs @@ -899,7 +899,7 @@ $rules = [ * Risky when PHPUnit classes are overridden or not accessible, or * when project has PHPUnit incompatibilities. */ - 'php_unit_expectation' => true, + 'php_unit_expectation' => false, // PHPUnit annotations should be a FQCNs including a root namespace. 'php_unit_fqcn_annotation' => true, diff --git a/src/PhpZip/Exception/ZipUnsupportMethodException.php b/src/PhpZip/Exception/ZipUnsupportMethodException.php index dd66cce..2f03167 100644 --- a/src/PhpZip/Exception/ZipUnsupportMethodException.php +++ b/src/PhpZip/Exception/ZipUnsupportMethodException.php @@ -2,6 +2,9 @@ namespace PhpZip\Exception; +/** + * Class ZipUnsupportMethodException. + */ class ZipUnsupportMethodException extends RuntimeException { } diff --git a/src/PhpZip/Model/EndOfCentralDirectory.php b/src/PhpZip/Model/EndOfCentralDirectory.php index f27d57f..93716bd 100644 --- a/src/PhpZip/Model/EndOfCentralDirectory.php +++ b/src/PhpZip/Model/EndOfCentralDirectory.php @@ -81,7 +81,7 @@ class EndOfCentralDirectory private $entryCount; /** @var bool */ - private $zip64 = false; + private $zip64; /** * EndOfCentralDirectory constructor. diff --git a/src/PhpZip/Stream/ZipInputStream.php b/src/PhpZip/Stream/ZipInputStream.php index b2e677f..bd0d777 100644 --- a/src/PhpZip/Stream/ZipInputStream.php +++ b/src/PhpZip/Stream/ZipInputStream.php @@ -507,6 +507,7 @@ class ZipInputStream implements ZipInputStreamInterface break; case ZipFileInterface::METHOD_DEFLATED: + /** @noinspection PhpUsageOfSilenceOperatorInspection */ $content = @gzinflate($content); break; diff --git a/src/PhpZip/ZipFile.php b/src/PhpZip/ZipFile.php index aacf4e0..2a3aba4 100644 --- a/src/PhpZip/ZipFile.php +++ b/src/PhpZip/ZipFile.php @@ -1,5 +1,7 @@ stream_open($path, $mode, $options)" . PHP_EOL; - $parsedUrl = parse_url($path); $path = $parsedUrl['path']; $this->fp = fopen($path, $mode); @@ -21,37 +27,46 @@ class DummyFileSystemStream return true; } + /** + * @param $count + * + * @return false|string + */ public function stream_read($count) { -// echo "DummyFileSystemStream->stream_read($count)" . PHP_EOL; - $position = ftell($this->fp); - -// echo "Loading chunk " . $position . " to " . ($position + $count - 1) . PHP_EOL; return fread($this->fp, $count); -// echo "String length: " . strlen($ret) . PHP_EOL; } + /** + * @return false|int + */ public function stream_tell() { -// echo "DummyFileSystemStream->stream_tell()" . PHP_EOL; return ftell($this->fp); } + /** + * @return bool + */ public function stream_eof() { -// echo "DummyFileSystemStream->stream_eof()" . PHP_EOL; return feof($this->fp); } + /** + * @param $offset + * @param $whence + */ public function stream_seek($offset, $whence) { -// echo "DummyFileSystemStream->stream_seek($offset, $whence)" . PHP_EOL; fseek($this->fp, $offset, $whence); } + /** + * @return array + */ public function stream_stat() { -// echo "DummyFileSystemStream->stream_stat()" . PHP_EOL; return fstat($this->fp); } } diff --git a/tests/PhpZip/PhpZipExtResourceTest.php b/tests/PhpZip/PhpZipExtResourceTest.php index 98cb736..0ba2542 100644 --- a/tests/PhpZip/PhpZipExtResourceTest.php +++ b/tests/PhpZip/PhpZipExtResourceTest.php @@ -133,10 +133,10 @@ class PhpZipExtResourceTest extends ZipTestCase static::assertTrue(mkdir($this->outputDirname, 0755, true)); $zipFile = new ZipFile(); + $zipFile->openFile($filename); + $zipFile->setReadPassword('bar'); try { - $zipFile->openFile($filename); - $zipFile->setReadPassword('bar'); $zipFile->extractTo($this->outputDirname); static::markTestIncomplete('failed test'); } catch (ZipException $exception) {