Prechádzať zdrojové kódy

docs: fix grammar in exception messages, DocBlocks and README

- reword broken English in user-facing exception messages and update
  the matching test assertions (e.g. 'Can not password from entry',
  'Not support encryption zip', 'is exists').
- fix typos and awkward phrasing in DocBlocks across src ('flogs',
  'int local header', 'Amica OS', 'Asi Unix Extra Filed Data').
- fix grammar, articles and a wrong anchor link in README.md; update
  the ArrayIterator example to avoid a PHP 8.5 deprecation.
- grammar fixes in the GitHub issue and pull request templates.
Ne-Lexa 3 týždňov pred
rodič
commit
1941e0d7b8

+ 1 - 1
.github/ISSUE_TEMPLATE/1_Bug_report.md

@@ -8,7 +8,7 @@ about: Report errors and problems
 | -----------------------------| ---
 | -----------------------------| ---
 | Library version(s) affected: | x.y.z
 | Library version(s) affected: | x.y.z
 | PHP version(s):              | x.y.z
 | PHP version(s):              | x.y.z
-| OS (with bit depth):         | <!-- ex. Ubuntu 18.04 64-bit -->
+| OS (with bit depth):         | <!-- e.g. Ubuntu 18.04 64-bit -->
 
 
 **Description**  
 **Description**  
 <!-- A clear and concise description of the problem. -->
 <!-- A clear and concise description of the problem. -->

+ 12 - 12
.github/PULL_REQUEST_TEMPLATE.md

@@ -1,12 +1,12 @@
-| Q             | A
-| ------------- | ---
-| Bug fix?      | yes/no
-| New feature?  | yes/no <!-- don't forget to update CHANGELOG.md file -->
-
-<!--
-Write a short README entry for your feature/bugfix here (replace this comment block.)
-
-Do NOT send pull request to `master` branch.
-Please send to `develop` branch instead.
-Any PR to `master` branch will NOT be merged.
--->
+| Q             | A
+| ------------- | ---
+| Bug fix?      | yes/no
+| New feature?  | yes/no <!-- don't forget to describe the change in the release notes -->
+
+<!--
+Write a short description of your feature/bugfix here (replace this comment block).
+
+Do NOT send a pull request to the `master` branch.
+Please send it to the `develop` branch instead.
+Any PR to the `master` branch will NOT be merged.
+-->

+ 1 - 1
README.RU.md

@@ -773,7 +773,7 @@ $zipFile->outputAsPsr7Response($response, $outputFilename, $mimeType);
 ```php
 ```php
 $response = $zipFile->outputAsSymfonyResponse($outputFilename);
 $response = $zipFile->outputAsSymfonyResponse($outputFilename);
 ```
 ```
-Вы можете установить Mime-Type:
+Вы можете установить MIME-тип:
 ```php
 ```php
 $mimeType = 'application/zip';
 $mimeType = 'application/zip';
 $response = $zipFile->outputAsSymfonyResponse($outputFilename, $mimeType);
 $response = $zipFile->outputAsSymfonyResponse($outputFilename, $mimeType);

+ 88 - 88
README.md

@@ -1,6 +1,6 @@
 <h1 align="center"><img src="logo.svg" alt="PhpZip" width="250" height="51"></h1>
 <h1 align="center"><img src="logo.svg" alt="PhpZip" width="250" height="51"></h1>
 
 
-`PhpZip` is a php-library for extended work with ZIP-archives.
+`PhpZip` is a PHP library for extended work with ZIP archives.
 
 
 [![Packagist Version](https://img.shields.io/packagist/v/nelexa/zip.svg)](https://packagist.org/packages/nelexa/zip)
 [![Packagist Version](https://img.shields.io/packagist/v/nelexa/zip.svg)](https://packagist.org/packages/nelexa/zip)
 [![Packagist Downloads](https://img.shields.io/packagist/dt/nelexa/zip.svg?color=%23ff007f)](https://packagist.org/packages/nelexa/zip)
 [![Packagist Downloads](https://img.shields.io/packagist/dt/nelexa/zip.svg?color=%23ff007f)](https://packagist.org/packages/nelexa/zip)
@@ -24,7 +24,7 @@ Table of contents
 - [Glossary](#glossary)
 - [Glossary](#glossary)
 - [Documentation](#documentation)
 - [Documentation](#documentation)
   + [Overview of methods of the class `\PhpZip\ZipFile`](#overview-of-methods-of-the-class-phpzipzipfile)
   + [Overview of methods of the class `\PhpZip\ZipFile`](#overview-of-methods-of-the-class-phpzipzipfile)
-  + [Creation/Opening of ZIP-archive](#creationopening-of-zip-archive)
+  + [Creation/Opening of ZIP archive](#creationopening-of-zip-archive)
   + [Reading entries from the archive](#reading-entries-from-the-archive)
   + [Reading entries from the archive](#reading-entries-from-the-archive)
   + [Iterating entries](#iterating-entries)
   + [Iterating entries](#iterating-entries)
   + [Getting information about entries](#getting-information-about-entries)
   + [Getting information about entries](#getting-information-about-entries)
@@ -43,14 +43,14 @@ Table of contents
 
 
 ### Features
 ### Features
 - Opening and unzipping zip files.
 - Opening and unzipping zip files.
-- Creating ZIP-archives.
+- Creating ZIP archives.
 - Modifying ZIP archives.
 - Modifying ZIP archives.
-- Pure php (not require extension `php-zip` and class `\ZipArchive`).
+- Pure PHP (does not require the `php-zip` extension or the `\ZipArchive` class).
 - It supports saving the archive to a file, outputting the archive to the browser, or outputting it as a string without saving it to a file.
 - It supports saving the archive to a file, outputting the archive to the browser, or outputting it as a string without saving it to a file.
-- Archival comments and comments of individual entry are supported.
+- Archive comments and comments for individual entries are supported.
 - Get information about each entry in the archive.
 - Get information about each entry in the archive.
 - Only the following compression methods are supported:
 - Only the following compression methods are supported:
-  + No compressed (Stored).
+  + No compression (Stored).
   + Deflate compression.
   + Deflate compression.
   + BZIP2 compression with the extension `php-bz2`.
   + BZIP2 compression with the extension `php-bz2`.
 - Support for `ZIP64` (file size is more than 4 GB or the number of entries in the archive is more than 65535).
 - Support for `ZIP64` (file size is more than 4 GB or the number of entries in the archive is more than 65535).
@@ -58,11 +58,11 @@ Table of contents
   > **Attention!**
   > **Attention!**
   >
   >
   > For 32-bit systems, the `Traditional PKWARE Encryption (ZipCrypto)` encryption method is not currently supported. 
   > For 32-bit systems, the `Traditional PKWARE Encryption (ZipCrypto)` encryption method is not currently supported. 
-  > Use the encryption method `WinZIP AES Encryption`, whenever possible.
+  > Use the `WinZIP AES Encryption` method whenever possible.
   + Set the password to read the archive for all entries or only for some.
   + Set the password to read the archive for all entries or only for some.
   + Change the password for the archive, including for individual entries.
   + Change the password for the archive, including for individual entries.
   + Delete the archive password for all or individual entries.
   + Delete the archive password for all or individual entries.
-  + Set the password and/or the encryption method, both for all, and for individual entries in the archive.
+  + Set the password and/or the encryption method for all entries or for individual entries in the archive.
   + Set different passwords and encryption methods for different entries.
   + Set different passwords and encryption methods for different entries.
   + Delete the password for all or some entries.
   + Delete the password for all or some entries.
   + Support `Traditional PKWARE Encryption (ZipCrypto)` and `WinZIP AES Encryption` encryption methods.
   + Support `Traditional PKWARE Encryption (ZipCrypto)` and `WinZIP AES Encryption` encryption methods.
@@ -70,8 +70,8 @@ Table of contents
 
 
 ### Requirements
 ### Requirements
 - `PHP` >= 7.4 or `PHP` >= 8.0 (preferably 64-bit).
 - `PHP` >= 7.4 or `PHP` >= 8.0 (preferably 64-bit).
-- Optional php-extension `bzip2` for BZIP2 compression.
-- Optional php-extension `openssl` for `WinZip Aes Encryption` support.
+- Optional PHP extension `bzip2` for BZIP2 compression.
+- Optional PHP extension `openssl` for `WinZip AES Encryption` support.
 
 
 ### Installation
 ### Installation
 `composer require nelexa/zip`
 `composer require nelexa/zip`
@@ -84,8 +84,8 @@ Latest stable version: [![Latest Stable Version](https://poser.pugx.org/nelexa/z
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 try{
 try{
     $zipFile
     $zipFile
-        ->addFromString('zip/entry/filename', 'Is file content') // add an entry from the string
-        ->addFile('/path/to/file', 'data/tofile') // add an entry from the file
+        ->addFromString('zip/entry/filename', 'Is file content') // add an entry from a string
+        ->addFile('/path/to/file', 'data/tofile') // add an entry from a file
         ->addDir(__DIR__, 'to/path/') // add files from the directory
         ->addDir(__DIR__, 'to/path/') // add files from the directory
         ->saveAsFile($outputFilename) // save the archive to a file
         ->saveAsFile($outputFilename) // save the archive to a file
         ->close(); // close archive
         ->close(); // close archive
@@ -106,22 +106,22 @@ finally{
     $zipFile->close();
     $zipFile->close();
 }
 }
 ```
 ```
-Other examples can be found in the `tests/` folder
+Other examples can be found in the `tests/` folder.
 
 
 ### Glossary
 ### Glossary
-**Zip Entry** - file or folder in a ZIP-archive. Each entry in the archive has certain properties, for example: file name, compression method, encryption method, file size before compression, file size after compression, CRC32 and others.
+**Zip Entry** - a file or folder in a ZIP archive. Each entry in the archive has certain properties, for example: file name, compression method, encryption method, file size before compression, file size after compression, CRC32 and others.
 
 
 ### Documentation:
 ### Documentation:
 #### Overview of methods of the class `\PhpZip\ZipFile`
 #### Overview of methods of the class `\PhpZip\ZipFile`
 - [ZipFile::__construct](#zipfile__construct) - initializes the ZIP archive.
 - [ZipFile::__construct](#zipfile__construct) - initializes the ZIP archive.
 - [ZipFile::addAll](#zipfileaddall) - adds all entries from an array.
 - [ZipFile::addAll](#zipfileaddall) - adds all entries from an array.
-- [ZipFile::addDir](#zipfileadddir) - adds files to the archive from the directory on the specified path without subdirectories.
-- [ZipFile::addDirRecursive](#zipfileadddirrecursive) - adds files to the archive from the directory on the specified path with subdirectories.
+- [ZipFile::addDir](#zipfileadddir) - adds files to the archive from the directory at the specified path without subdirectories.
+- [ZipFile::addDirRecursive](#zipfileadddirrecursive) - adds files to the archive from the directory at the specified path with subdirectories.
 - [ZipFile::addEmptyDir](#zipfileaddemptydir) - add a new directory.
 - [ZipFile::addEmptyDir](#zipfileaddemptydir) - add a new directory.
 - [ZipFile::addFile](#zipfileaddfile) - adds a file to a ZIP archive from the given path.
 - [ZipFile::addFile](#zipfileaddfile) - adds a file to a ZIP archive from the given path.
 - [ZipFile::addSplFile](#zipfileaddsplfile) - adds a `\SplFileInfo` to a ZIP archive.
 - [ZipFile::addSplFile](#zipfileaddsplfile) - adds a `\SplFileInfo` to a ZIP archive.
 - [ZipFile::addFromFinder](#zipfileaddfromfinder) - adds files from the `Symfony\Component\Finder\Finder` to a ZIP archive.
 - [ZipFile::addFromFinder](#zipfileaddfromfinder) - adds files from the `Symfony\Component\Finder\Finder` to a ZIP archive.
-- [ZipFile::addFilesFromIterator](#zipfileaddfilesfromiterator) - adds files from the iterator of directories.
+- [ZipFile::addFilesFromIterator](#zipfileaddfilesfromiterator) - adds files from a directory iterator.
 - [ZipFile::addFilesFromGlob](#zipfileaddfilesfromglob) - adds files from a directory by glob pattern without subdirectories.
 - [ZipFile::addFilesFromGlob](#zipfileaddfilesfromglob) - adds files from a directory by glob pattern without subdirectories.
 - [ZipFile::addFilesFromGlobRecursive](#zipfileaddfilesfromglobrecursive) - adds files from a directory by glob pattern with subdirectories.
 - [ZipFile::addFilesFromGlobRecursive](#zipfileaddfilesfromglobrecursive) - adds files from a directory by glob pattern with subdirectories.
 - [ZipFile::addFilesFromRegex](#zipfileaddfilesfromregex) - adds files from a directory by PCRE pattern without subdirectories.
 - [ZipFile::addFilesFromRegex](#zipfileaddfilesfromregex) - adds files from a directory by PCRE pattern without subdirectories.
@@ -131,63 +131,63 @@ Other examples can be found in the `tests/` folder
 - [ZipFile::close](#zipfileclose) - close the archive.
 - [ZipFile::close](#zipfileclose) - close the archive.
 - [ZipFile::count](#zipfilecount) - returns the number of entries in the archive.
 - [ZipFile::count](#zipfilecount) - returns the number of entries in the archive.
 - [ZipFile::deleteFromName](#zipfiledeletefromname) - deletes an entry in the archive using its name.
 - [ZipFile::deleteFromName](#zipfiledeletefromname) - deletes an entry in the archive using its name.
-- [ZipFile::deleteFromGlob](#zipfiledeletefromglob) - deletes an entries in the archive using glob pattern.
-- [ZipFile::deleteFromRegex](#zipfiledeletefromregex) - deletes an entries in the archive using PCRE pattern.
+- [ZipFile::deleteFromGlob](#zipfiledeletefromglob) - deletes entries in the archive using a glob pattern.
+- [ZipFile::deleteFromRegex](#zipfiledeletefromregex) - deletes entries in the archive using a PCRE pattern.
 - [ZipFile::deleteAll](#zipfiledeleteall) - deletes all entries in the ZIP archive.
 - [ZipFile::deleteAll](#zipfiledeleteall) - deletes all entries in the ZIP archive.
 - [ZipFile::disableEncryption](#zipfiledisableencryption) - disable encryption for all entries that are already in the archive.
 - [ZipFile::disableEncryption](#zipfiledisableencryption) - disable encryption for all entries that are already in the archive.
-- [ZipFile::disableEncryptionEntry](#zipfiledisableencryptionentry) - disable encryption of an entry defined by its name.
+- [ZipFile::disableEncryptionEntry](#zipfiledisableencryptionentry) - disables encryption of an entry identified by its name.
 - [ZipFile::extractTo](#zipfileextractto) - extract the archive contents.
 - [ZipFile::extractTo](#zipfileextractto) - extract the archive contents.
 - [ZipFile::getArchiveComment](#zipfilegetarchivecomment) - returns the Zip archive comment.
 - [ZipFile::getArchiveComment](#zipfilegetarchivecomment) - returns the Zip archive comment.
 - [ZipFile::getEntryComment](#zipfilegetentrycomment) - returns the comment of an entry using the entry name.
 - [ZipFile::getEntryComment](#zipfilegetentrycomment) - returns the comment of an entry using the entry name.
 - [ZipFile::getEntryContent](#zipfilegetentrycontent) - returns the entry contents using its name.
 - [ZipFile::getEntryContent](#zipfilegetentrycontent) - returns the entry contents using its name.
-- [ZipFile::getListFiles](#zipfilegetlistfiles) - returns list of archive files.
+- [ZipFile::getListFiles](#zipfilegetlistfiles) - returns the list of archive files.
 - [ZipFile::hasEntry](#zipfilehasentry) - checks if there is an entry in the archive.
 - [ZipFile::hasEntry](#zipfilehasentry) - checks if there is an entry in the archive.
 - [ZipFile::isDirectory](#zipfileisdirectory) - checks that the entry in the archive is a directory.
 - [ZipFile::isDirectory](#zipfileisdirectory) - checks that the entry in the archive is a directory.
 - [ZipFile::matcher](#zipfilematcher) - selecting entries in the archive to perform operations on them.
 - [ZipFile::matcher](#zipfilematcher) - selecting entries in the archive to perform operations on them.
-- [ZipFile::openFile](#zipfileopenfile) - opens a zip-archive from a file.
-- [ZipFile::openFromString](#zipfileopenfromstring) - opens a zip-archive from a string.
-- [ZipFile::openFromStream](#zipfileopenfromstream) - opens a zip-archive from the stream.
-- [ZipFile::outputAsAttachment](#zipfileoutputasattachment) - outputs a ZIP-archive to the browser.
-- [ZipFile::outputAsPsr7Response](#zipfileoutputaspsr7response) - outputs a ZIP-archive as PSR-7 Response.
-- [ZipFile::outputAsSymfonyResponse](#zipfileoutputaspsr7response) - outputs a ZIP-archive as Symfony Response.
-- [ZipFile::outputAsString](#zipfileoutputasstring) - outputs a ZIP-archive as string.
-- [ZipFile::rename](#zipfilerename) - renames an entry defined by its name.
+- [ZipFile::openFile](#zipfileopenfile) - opens a zip archive from a file.
+- [ZipFile::openFromString](#zipfileopenfromstring) - opens a zip archive from a string.
+- [ZipFile::openFromStream](#zipfileopenfromstream) - opens a zip archive from a stream.
+- [ZipFile::outputAsAttachment](#zipfileoutputasattachment) - outputs a ZIP archive to the browser.
+- [ZipFile::outputAsPsr7Response](#zipfileoutputaspsr7response) - outputs a ZIP archive as a PSR-7 Response.
+- [ZipFile::outputAsSymfonyResponse](#zipfileoutputassymfonyresponse) - outputs a ZIP archive as a Symfony Response.
+- [ZipFile::outputAsString](#zipfileoutputasstring) - outputs a ZIP archive as a string.
+- [ZipFile::rename](#zipfilerename) - renames an entry identified by its name.
 - [ZipFile::rewrite](#zipfilerewrite) - save changes and re-open the changed archive.
 - [ZipFile::rewrite](#zipfilerewrite) - save changes and re-open the changed archive.
 - [ZipFile::saveAsFile](#zipfilesaveasfile) - saves the archive to a file.
 - [ZipFile::saveAsFile](#zipfilesaveasfile) - saves the archive to a file.
-- [ZipFile::saveAsStream](#zipfilesaveasstream) - writes the archive to the stream.
+- [ZipFile::saveAsStream](#zipfilesaveasstream) - writes the archive to a stream.
 - [ZipFile::setArchiveComment](#zipfilesetarchivecomment) - set the comment of a ZIP archive.
 - [ZipFile::setArchiveComment](#zipfilesetarchivecomment) - set the comment of a ZIP archive.
 - [ZipFile::setCompressionLevel](#zipfilesetcompressionlevel) - set the compression level for all files in the archive.
 - [ZipFile::setCompressionLevel](#zipfilesetcompressionlevel) - set the compression level for all files in the archive.
 - [ZipFile::setCompressionLevelEntry](#zipfilesetcompressionlevelentry) - sets the compression level for the entry by its name.
 - [ZipFile::setCompressionLevelEntry](#zipfilesetcompressionlevelentry) - sets the compression level for the entry by its name.
 - [ZipFile::setCompressionMethodEntry](#zipfilesetcompressionmethodentry) - sets the compression method for the entry by its name.
 - [ZipFile::setCompressionMethodEntry](#zipfilesetcompressionmethodentry) - sets the compression method for the entry by its name.
-- [ZipFile::setEntryComment](#zipfilesetentrycomment) - set the comment of an entry defined by its name.
+- [ZipFile::setEntryComment](#zipfilesetentrycomment) - sets the comment of an entry identified by its name.
 - [ZipFile::setReadPassword](#zipfilesetreadpassword) - set the password for the open archive.
 - [ZipFile::setReadPassword](#zipfilesetreadpassword) - set the password for the open archive.
-- [ZipFile::setReadPasswordEntry](#zipfilesetreadpasswordentry) - sets a password for reading of an entry defined by its name.
+- [ZipFile::setReadPasswordEntry](#zipfilesetreadpasswordentry) - sets a password for reading an entry identified by its name.
 - [ZipFile::setPassword](#zipfilesetpassword) - sets a new password for all files in the archive.
 - [ZipFile::setPassword](#zipfilesetpassword) - sets a new password for all files in the archive.
-- [ZipFile::setPasswordEntry](#zipfilesetpasswordentry) - sets a new password of an entry defined by its name.
-- [ZipFile::unchangeAll](#zipfileunchangeall) - undo all changes done in the archive.
+- [ZipFile::setPasswordEntry](#zipfilesetpasswordentry) - sets a new password for an entry identified by its name.
+- [ZipFile::unchangeAll](#zipfileunchangeall) - undoes all changes made to the archive.
 - [ZipFile::unchangeArchiveComment](#zipfileunchangearchivecomment) - undo changes to the archive comment.
 - [ZipFile::unchangeArchiveComment](#zipfileunchangearchivecomment) - undo changes to the archive comment.
-- [ZipFile::unchangeEntry](#zipfileunchangeentry) - undo changes of an entry defined by its name.
+- [ZipFile::unchangeEntry](#zipfileunchangeentry) - undoes changes to an entry identified by its name.
 
 
-#### Creation/Opening of ZIP-archive
+#### Creation/Opening of ZIP archive
 ##### ZipFile::__construct**
 ##### ZipFile::__construct**
 Initializes the ZIP archive
 Initializes the ZIP archive
 ```php
 ```php
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 ```
 ```
 ##### ZipFile::openFile
 ##### ZipFile::openFile
-Opens a zip-archive from a file.
+Opens a zip archive from a file.
 ```php
 ```php
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 $zipFile->openFile('file.zip');
 $zipFile->openFile('file.zip');
 ```
 ```
 ##### ZipFile::openFromString
 ##### ZipFile::openFromString
-Opens a zip-archive from a string.
+Opens a zip archive from a string.
 ```php
 ```php
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 $zipFile->openFromString($stringContents);
 $zipFile->openFromString($stringContents);
 ```
 ```
 ##### ZipFile::openFromStream
 ##### ZipFile::openFromStream
-Opens a zip-archive from the stream.
+Opens a zip archive from a stream.
 ```php
 ```php
 $stream = fopen('file.zip', 'rb');
 $stream = fopen('file.zip', 'rb');
 
 
@@ -267,7 +267,7 @@ $zipFile->extractTo($toDirectory, $extractOnlyFiles);
 ```
 ```
 #### Iterating entries
 #### Iterating entries
 `ZipFile` is an iterator.
 `ZipFile` is an iterator.
-Can iterate all the entries in the `foreach` loop.
+You can iterate over all entries in a `foreach` loop.
 ```php
 ```php
 foreach($zipFile as $entryName => $contents){
 foreach($zipFile as $entryName => $contents){
     echo "Filename: $entryName" . PHP_EOL;
     echo "Filename: $entryName" . PHP_EOL;
@@ -275,9 +275,9 @@ foreach($zipFile as $entryName => $contents){
     echo '-----------------------------' . PHP_EOL;
     echo '-----------------------------' . PHP_EOL;
 }
 }
 ```
 ```
-Can iterate through the `Iterator`.
+You can iterate using the `Iterator` interface.
 ```php
 ```php
-$iterator = new \ArrayIterator($zipFile);
+$iterator = new \ArrayIterator(iterator_to_array($zipFile));
 while ($iterator->valid())
 while ($iterator->valid())
 {
 {
     $entryName = $iterator->key();
     $entryName = $iterator->key();
@@ -464,7 +464,7 @@ $zipFile->addFilesFromIterator($directoryIterator, $localPath, \PhpZip\Constants
 $zipFile->addFilesFromIterator($directoryIterator, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
 $zipFile->addFilesFromIterator($directoryIterator, $localPath, \PhpZip\Constants\ZipCompressionMethod::DEFLATED); // Deflate compression
 $zipFile->addFilesFromIterator($directoryIterator, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
 $zipFile->addFilesFromIterator($directoryIterator, $localPath, \PhpZip\Constants\ZipCompressionMethod::BZIP2); // BZIP2 compression
 ```
 ```
-Example with some files ignoring:
+Example that ignores some files:
 ```php
 ```php
 $ignoreFiles = [
 $ignoreFiles = [
     'file_ignore.txt', 
     'file_ignore.txt', 
@@ -486,7 +486,7 @@ $zipFile->addFilesFromIterator($ignoreIterator);
 ##### ZipFile::addFilesFromGlob
 ##### ZipFile::addFilesFromGlob
 Adds files from a directory by [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) without subdirectories.
 Adds files from a directory by [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) without subdirectories.
 ```php
 ```php
-$globPattern = '**.{jpg,jpeg,png,gif}'; // example glob pattern -> add all .jpg, .jpeg, .png and .gif files
+$globPattern = '**.{jpg,jpeg,png,gif}'; // example glob pattern: adds all .jpg, .jpeg, .png and .gif files
 
 
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 $zipFile->addFilesFromGlob($dir, $globPattern);
 $zipFile->addFilesFromGlob($dir, $globPattern);
@@ -503,7 +503,7 @@ $zipFile->addFilesFromGlob($dir, $globPattern, $localPath, \PhpZip\Constants\Zip
 ##### ZipFile::addFilesFromGlobRecursive
 ##### ZipFile::addFilesFromGlobRecursive
 Adds files from a directory by [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) with subdirectories.
 Adds files from a directory by [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) with subdirectories.
 ```php
 ```php
-$globPattern = '**.{jpg,jpeg,png,gif}'; // example glob pattern -> add all .jpg, .jpeg, .png and .gif files
+$globPattern = '**.{jpg,jpeg,png,gif}'; // example glob pattern: adds all .jpg, .jpeg, .png and .gif files
 
 
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 $zipFile->addFilesFromGlobRecursive($dir, $globPattern);
 $zipFile->addFilesFromGlobRecursive($dir, $globPattern);
@@ -520,7 +520,7 @@ $zipFile->addFilesFromGlobRecursive($dir, $globPattern, $localPath, \PhpZip\Cons
 ##### ZipFile::addFilesFromRegex
 ##### ZipFile::addFilesFromRegex
 Adds files from a directory by [PCRE pattern](https://en.wikipedia.org/wiki/Regular_expression) without subdirectories.
 Adds files from a directory by [PCRE pattern](https://en.wikipedia.org/wiki/Regular_expression) without subdirectories.
 ```php
 ```php
-$regexPattern = '/\.(jpe?g|png|gif)$/si'; // example regex pattern -> add all .jpg, .jpeg, .png and .gif files
+$regexPattern = '/\.(jpe?g|png|gif)$/si'; // example regex pattern: adds all .jpg, .jpeg, .png and .gif files
 
 
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 $zipFile->addFilesFromRegex($dir, $regexPattern);
 $zipFile->addFilesFromRegex($dir, $regexPattern);
@@ -537,7 +537,7 @@ $zipFile->addFilesFromRegex($dir, $regexPattern, $localPath, \PhpZip\Constants\Z
 ##### ZipFile::addFilesFromRegexRecursive
 ##### ZipFile::addFilesFromRegexRecursive
 Adds files from a directory by [PCRE pattern](https://en.wikipedia.org/wiki/Regular_expression) with subdirectories.
 Adds files from a directory by [PCRE pattern](https://en.wikipedia.org/wiki/Regular_expression) with subdirectories.
 ```php
 ```php
-$regexPattern = '/\.(jpe?g|png|gif)$/si'; // example regex pattern -> add all .jpg, .jpeg, .png and .gif files
+$regexPattern = '/\.(jpe?g|png|gif)$/si'; // example regex pattern: adds all .jpg, .jpeg, .png and .gif files
 
 
 $zipFile->addFilesFromRegexRecursive($dir, $regexPattern);
 $zipFile->addFilesFromRegexRecursive($dir, $regexPattern);
 
 
@@ -558,17 +558,17 @@ $zipFile = new \PhpZip\ZipFile();
 $zipFile->deleteFromName($entryName);
 $zipFile->deleteFromName($entryName);
 ```
 ```
 ##### ZipFile::deleteFromGlob
 ##### ZipFile::deleteFromGlob
-Deletes a entries in the archive using [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)).
+Deletes entries in the archive using a [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)).
 ```php
 ```php
-$globPattern = '**.{jpg,jpeg,png,gif}'; // example glob pattern -> delete all .jpg, .jpeg, .png and .gif files
+$globPattern = '**.{jpg,jpeg,png,gif}'; // example glob pattern: deletes all .jpg, .jpeg, .png and .gif files
 
 
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 $zipFile->deleteFromGlob($globPattern);
 $zipFile->deleteFromGlob($globPattern);
 ```
 ```
 ##### ZipFile::deleteFromRegex
 ##### ZipFile::deleteFromRegex
-Deletes a entries in the archive using [PCRE pattern](https://en.wikipedia.org/wiki/Regular_expression).
+Deletes entries in the archive using a [PCRE pattern](https://en.wikipedia.org/wiki/Regular_expression).
 ```php
 ```php
-$regexPattern = '/\.(jpe?g|png|gif)$/si'; // example regex pattern -> delete all .jpg, .jpeg, .png and .gif files
+$regexPattern = '/\.(jpe?g|png|gif)$/si'; // example regex pattern: deletes all .jpg, .jpeg, .png and .gif files
 
 
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 $zipFile->deleteFromRegex($regexPattern);
 $zipFile->deleteFromRegex($regexPattern);
@@ -581,7 +581,7 @@ $zipFile->deleteAll();
 ```
 ```
 #### Working with entries and archive
 #### Working with entries and archive
 ##### ZipFile::rename
 ##### ZipFile::rename
-Renames an entry defined by its name.
+Renames an entry identified by its name.
 ```php
 ```php
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 $zipFile->rename($oldName, $newName);
 $zipFile->rename($oldName, $newName);
@@ -593,7 +593,7 @@ Set the compression level for all files in the archive.
 
 
 By default, the compression level is 5 (`\PhpZip\Constants\ZipCompressionLevel::NORMAL`) or the compression level specified in the archive for Deflate compression.
 By default, the compression level is 5 (`\PhpZip\Constants\ZipCompressionLevel::NORMAL`) or the compression level specified in the archive for Deflate compression.
 
 
-The values range from 1 (`\PhpZip\Constants\ZipCompressionLevel::SUPER_FAST`) to 9 (`\PhpZip\Constants\ZipCompressionLevel::MAXIMUM`) are supported. The higher the number, the better and longer the compression.
+Supported values range from 1 (`\PhpZip\Constants\ZipCompressionLevel::SUPER_FAST`) to 9 (`\PhpZip\Constants\ZipCompressionLevel::MAXIMUM`). The higher the number, the better and longer the compression.
 ```php
 ```php
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 $zipFile->setCompressionLevel(\PhpZip\Constants\ZipCompressionLevel::MAXIMUM);
 $zipFile->setCompressionLevel(\PhpZip\Constants\ZipCompressionLevel::MAXIMUM);
@@ -601,7 +601,7 @@ $zipFile->setCompressionLevel(\PhpZip\Constants\ZipCompressionLevel::MAXIMUM);
 ##### ZipFile::setCompressionLevelEntry
 ##### ZipFile::setCompressionLevelEntry
 Sets the compression level for the entry by its name.
 Sets the compression level for the entry by its name.
 
 
-The values range from 1 (`\PhpZip\Constants\ZipCompressionLevel::SUPER_FAST`) to 9 (`\PhpZip\Constants\ZipCompressionLevel::MAXIMUM`) are supported. The higher the number, the better and longer the compression.
+Supported values range from 1 (`\PhpZip\Constants\ZipCompressionLevel::SUPER_FAST`) to 9 (`\PhpZip\Constants\ZipCompressionLevel::MAXIMUM`). The higher the number, the better and longer the compression.
 ```php
 ```php
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 $zipFile->setCompressionLevelEntry($entryName, \PhpZip\Constants\ZipCompressionLevel::FAST);
 $zipFile->setCompressionLevelEntry($entryName, \PhpZip\Constants\ZipCompressionLevel::FAST);
@@ -624,7 +624,7 @@ $zipFile = new \PhpZip\ZipFile();
 $zipFile->setArchiveComment($commentArchive);
 $zipFile->setArchiveComment($commentArchive);
 ```
 ```
 ##### ZipFile::setEntryComment
 ##### ZipFile::setEntryComment
-Set the comment of an entry defined by its name.
+Sets the comment of an entry identified by its name.
 ```php
 ```php
 $zipFile = new \PhpZip\ZipFile();
 $zipFile = new \PhpZip\ZipFile();
 $zipFile->setEntryComment($entryName, $comment);
 $zipFile->setEntryComment($entryName, $comment);
@@ -641,7 +641,7 @@ $matcher
     ->add('entry name')
     ->add('entry name')
     ->add('another entry');
     ->add('another entry');
 ```
 ```
-Select multiple files in the archive:
+Selecting multiple files in the archive:
 ```php
 ```php
 $matcher->add([
 $matcher->add([
     'entry name',
     'entry name',
@@ -653,7 +653,7 @@ Selecting files by regular expression:
 ```php
 ```php
 $matcher->match('~\.jpe?g$~i');
 $matcher->match('~\.jpe?g$~i');
 ```
 ```
-Select all files in the archive:
+Selecting all files in the archive:
 ```php
 ```php
 $matcher->all();
 $matcher->all();
 ```
 ```
@@ -668,7 +668,7 @@ getMatches() - returns a list of selected entries:
 $entries = $matcher->getMatches();
 $entries = $matcher->getMatches();
 // example array contents: ['entry name', 'another entry name'];
 // example array contents: ['entry name', 'another entry name'];
 ```
 ```
-invoke() - invoke a callable function on selected entries:
+invoke() - calls a callable function on the selected entries:
 ```php
 ```php
 // example
 // example
 $matcher->invoke(static function($entryName) use($zipFile) {
 $matcher->invoke(static function($entryName) use($zipFile) {
@@ -676,17 +676,17 @@ $matcher->invoke(static function($entryName) use($zipFile) {
     $zipFile->rename($entryName, $newName);
     $zipFile->rename($entryName, $newName);
 });
 });
 ```
 ```
-Functions for working on the selected entries:
+Functions for working with the selected entries:
 ```php
 ```php
-$matcher->delete(); // remove selected entries from a ZIP archive
+$matcher->delete(); // removes the selected entries from a ZIP archive
 $matcher->setPassword($password); // sets a new password for the selected entries
 $matcher->setPassword($password); // sets a new password for the selected entries
-$matcher->setPassword($password, $encryptionMethod); // sets a new password and encryption method to selected entries
-$matcher->setEncryptionMethod($encryptionMethod); // sets the encryption method to the selected entries
+$matcher->setPassword($password, $encryptionMethod); // sets a new password and encryption method for the selected entries
+$matcher->setEncryptionMethod($encryptionMethod); // sets the encryption method for the selected entries
 $matcher->disableEncryption(); // disables encryption for selected entries
 $matcher->disableEncryption(); // disables encryption for selected entries
 ```
 ```
 #### Working with passwords
 #### Working with passwords
 
 
-Implemented support for encryption methods:
+The following encryption methods are implemented:
 - `\PhpZip\Constants\ZipEncryptionMethod::PKWARE` - Traditional PKWARE encryption (legacy)
 - `\PhpZip\Constants\ZipEncryptionMethod::PKWARE` - Traditional PKWARE encryption (legacy)
 - `\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256` - WinZip AES encryption 256 bit (recommended)
 - `\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256` - WinZip AES encryption 256 bit (recommended)
 - `\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_192` - WinZip AES encryption 192 bit
 - `\PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_192` - WinZip AES encryption 192 bit
@@ -695,12 +695,12 @@ Implemented support for encryption methods:
 ##### ZipFile::setReadPassword
 ##### ZipFile::setReadPassword
 Set the password for the open archive.
 Set the password for the open archive.
 
 
-> _Setting a password is not required for adding new entries or deleting existing ones, but if you want to extract the content or change the method / compression level, the encryption method, or change the password, in this case the password must be specified._
+> _Setting a password is not required for adding new entries or deleting existing ones. However, to extract content, or to change the compression level, the encryption method or the password, the password must be specified._
 ```php
 ```php
 $zipFile->setReadPassword($password);
 $zipFile->setReadPassword($password);
 ```
 ```
 ##### ZipFile::setReadPasswordEntry
 ##### ZipFile::setReadPasswordEntry
-Gets a password for reading of an entry defined by its name.
+Sets a password for reading an entry identified by its name.
 ```php
 ```php
 $zipFile->setReadPasswordEntry($entryName, $password);
 $zipFile->setReadPasswordEntry($entryName, $password);
 ```
 ```
@@ -717,7 +717,7 @@ $encryptionMethod = \PhpZip\Constants\ZipEncryptionMethod::WINZIP_AES_256;
 $zipFile->setPassword($password, $encryptionMethod);
 $zipFile->setPassword($password, $encryptionMethod);
 ```
 ```
 ##### ZipFile::setPasswordEntry
 ##### ZipFile::setPasswordEntry
-Sets a new password of an entry defined by its name.
+Sets a new password for an entry identified by its name.
 ```php
 ```php
 $zipFile->setPasswordEntry($entryName, $password);
 $zipFile->setPasswordEntry($entryName, $password);
 ```
 ```
@@ -734,13 +734,13 @@ Disable encryption for all entries that are already in the archive.
 $zipFile->disableEncryption();
 $zipFile->disableEncryption();
 ```
 ```
 ##### ZipFile::disableEncryptionEntry
 ##### ZipFile::disableEncryptionEntry
-Disable encryption of an entry defined by its name.
+Disables encryption of an entry identified by its name.
 ```php
 ```php
 $zipFile->disableEncryptionEntry($entryName);
 $zipFile->disableEncryptionEntry($entryName);
 ```
 ```
 #### Undo changes
 #### Undo changes
 ##### ZipFile::unchangeAll
 ##### ZipFile::unchangeAll
-Undo all changes done in the archive.
+Undo all changes made to the archive.
 ```php
 ```php
 $zipFile->unchangeAll();
 $zipFile->unchangeAll();
 ```
 ```
@@ -750,7 +750,7 @@ Undo changes to the archive comment.
 $zipFile->unchangeArchiveComment();
 $zipFile->unchangeArchiveComment();
 ```
 ```
 ##### ZipFile::unchangeEntry
 ##### ZipFile::unchangeEntry
-Undo changes of an entry defined by its name.
+Undo changes to an entry identified by its name.
 ```php
 ```php
 $zipFile->unchangeEntry($entryName);
 $zipFile->unchangeEntry($entryName);
 ```
 ```
@@ -761,53 +761,53 @@ Saves the archive to a file.
 $zipFile->saveAsFile($filename);
 $zipFile->saveAsFile($filename);
 ```
 ```
 ##### ZipFile::saveAsStream
 ##### ZipFile::saveAsStream
-Writes the archive to the stream.
+Writes the archive to a stream.
 ```php
 ```php
 // $fp = fopen($filename, 'w+b');
 // $fp = fopen($filename, 'w+b');
 
 
 $zipFile->saveAsStream($fp);
 $zipFile->saveAsStream($fp);
 ```
 ```
 ##### ZipFile::outputAsString
 ##### ZipFile::outputAsString
-Outputs a ZIP-archive as string.
+Outputs a ZIP archive as a string.
 ```php
 ```php
 $rawZipArchiveBytes = $zipFile->outputAsString();
 $rawZipArchiveBytes = $zipFile->outputAsString();
 ```
 ```
 ##### ZipFile::outputAsAttachment
 ##### ZipFile::outputAsAttachment
-Outputs a ZIP-archive to the browser.
+Outputs a ZIP archive to the browser.
 ```php
 ```php
 $zipFile->outputAsAttachment($outputFilename);
 $zipFile->outputAsAttachment($outputFilename);
 ```
 ```
-You can set the Mime-Type:
+You can set the MIME type:
 ```php
 ```php
 $mimeType = 'application/zip';
 $mimeType = 'application/zip';
 $zipFile->outputAsAttachment($outputFilename, $mimeType);
 $zipFile->outputAsAttachment($outputFilename, $mimeType);
 ```
 ```
 ##### ZipFile::outputAsPsr7Response
 ##### ZipFile::outputAsPsr7Response
-Outputs a ZIP-archive as [PSR-7 Response](http://www.php-fig.org/psr/psr-7/).
+Outputs a ZIP archive as a [PSR-7 Response](http://www.php-fig.org/psr/psr-7/).
 
 
-The output method can be used in any PSR-7 compatible framework. 
+The output method can be used in any PSR-7-compatible framework.
 ```php
 ```php
 // $response = ....; // instance Psr\Http\Message\ResponseInterface
 // $response = ....; // instance Psr\Http\Message\ResponseInterface
 $zipFile->outputAsPsr7Response($response, $outputFilename);
 $zipFile->outputAsPsr7Response($response, $outputFilename);
 ```
 ```
-You can set the Mime-Type:
+You can set the MIME type:
 ```php
 ```php
 $mimeType = 'application/zip';
 $mimeType = 'application/zip';
 $zipFile->outputAsPsr7Response($response, $outputFilename, $mimeType);
 $zipFile->outputAsPsr7Response($response, $outputFilename, $mimeType);
 ```
 ```
 ##### ZipFile::outputAsSymfonyResponse
 ##### ZipFile::outputAsSymfonyResponse
-Outputs a ZIP-archive as [Symfony Response](https://symfony.com/doc/current/components/http_foundation.html#response).
+Outputs a ZIP archive as a [Symfony Response](https://symfony.com/doc/current/components/http_foundation.html#response).
 
 
-The output method can be used in Symfony framework. 
+The output method can be used in the Symfony framework.
 ```php
 ```php
 $response = $zipFile->outputAsSymfonyResponse($outputFilename);
 $response = $zipFile->outputAsSymfonyResponse($outputFilename);
 ```
 ```
-You can set the Mime-Type:
+You can set the MIME type:
 ```php
 ```php
 $mimeType = 'application/zip';
 $mimeType = 'application/zip';
 $response = $zipFile->outputAsSymfonyResponse($outputFilename, $mimeType);
 $response = $zipFile->outputAsSymfonyResponse($outputFilename, $mimeType);
 ```
 ```
-Example use in Symfony Controller:
+Example of use in a Symfony controller:
 ```php
 ```php
 <?php
 <?php
 
 
@@ -835,7 +835,7 @@ class DownloadZipController
 }
 }
 ```
 ```
 ##### ZipFile::rewrite
 ##### ZipFile::rewrite
-Save changes and re-open the changed archive.
+Save changes and reopen the changed archive.
 ```php
 ```php
 $zipFile->rewrite();
 $zipFile->rewrite();
 ```
 ```
@@ -846,7 +846,7 @@ Close the archive.
 $zipFile->close();
 $zipFile->close();
 ```
 ```
 ### Running the tests
 ### Running the tests
-Install the dependencies for the development:
+Install the development dependencies:
 ```bash
 ```bash
 composer install --dev
 composer install --dev
 ```
 ```
@@ -859,7 +859,7 @@ Changes are documented in the [releases page](https://github.com/Ne-Lexa/php-zip
 
 
 ### Upgrade
 ### Upgrade
 #### Upgrade version 3 to version 4
 #### Upgrade version 3 to version 4
-Update the major version in the file `composer.json` to `^4.0`.
+Update the major version in the `composer.json` file to `^4.0`.
 ```json
 ```json
 {
 {
     "require": {
     "require": {
@@ -874,10 +874,10 @@ composer update nelexa/zip
 Update your code to work with the new version:
 Update your code to work with the new version:
 **BC**
 **BC**
 - removed deprecated classes and methods.
 - removed deprecated classes and methods.
-- removed `zipalign` functional. This functionality will be placed in a separate package `nelexa/apkfile`.
+- removed the `zipalign` functionality. This functionality will be placed in a separate package `nelexa/apkfile`.
 
 
 #### Upgrade version 2 to version 3
 #### Upgrade version 2 to version 3
-Update the major version in the file `composer.json` to `^3.0`.
+Update the major version in the `composer.json` file to `^3.0`.
 ```json
 ```json
 {
 {
     "require": {
     "require": {
@@ -890,15 +890,15 @@ Then install updates using `Composer`:
 composer update nelexa/zip
 composer update nelexa/zip
 ```
 ```
 Update your code to work with the new version:
 Update your code to work with the new version:
-- Class `ZipOutputFile` merged to `ZipFile` and removed.
+- The `ZipOutputFile` class was merged into `ZipFile` and removed.
   + `new \PhpZip\ZipOutputFile()` to `new \PhpZip\ZipFile()`
   + `new \PhpZip\ZipOutputFile()` to `new \PhpZip\ZipFile()`
-- Static initialization methods are now not static.
+- Static initialization methods are no longer static.
   + `\PhpZip\ZipFile::openFromFile($filename);` to `(new \PhpZip\ZipFile())->openFile($filename);`
   + `\PhpZip\ZipFile::openFromFile($filename);` to `(new \PhpZip\ZipFile())->openFile($filename);`
   + `\PhpZip\ZipOutputFile::openFromFile($filename);` to `(new \PhpZip\ZipFile())->openFile($filename);`
   + `\PhpZip\ZipOutputFile::openFromFile($filename);` to `(new \PhpZip\ZipFile())->openFile($filename);`
   + `\PhpZip\ZipFile::openFromString($contents);` to `(new \PhpZip\ZipFile())->openFromString($contents);`
   + `\PhpZip\ZipFile::openFromString($contents);` to `(new \PhpZip\ZipFile())->openFromString($contents);`
   + `\PhpZip\ZipFile::openFromStream($stream);` to `(new \PhpZip\ZipFile())->openFromStream($stream);`
   + `\PhpZip\ZipFile::openFromStream($stream);` to `(new \PhpZip\ZipFile())->openFromStream($stream);`
   + `\PhpZip\ZipOutputFile::create()` to `new \PhpZip\ZipFile()`
   + `\PhpZip\ZipOutputFile::create()` to `new \PhpZip\ZipFile()`
-  + `\PhpZip\ZipOutputFile::openFromZipFile(\PhpZip\ZipFile $zipFile)` &gt; `(new \PhpZip\ZipFile())->openFile($filename);`
+  + `\PhpZip\ZipOutputFile::openFromZipFile(\PhpZip\ZipFile $zipFile)` to `(new \PhpZip\ZipFile())->openFile($filename);`
 - Rename methods:
 - Rename methods:
   + `addFromFile` to `addFile`
   + `addFromFile` to `addFile`
   + `setLevel` to `setCompressionLevel`
   + `setLevel` to `setCompressionLevel`

+ 2 - 1
src/Constants/ZipPlatform.php

@@ -16,7 +16,7 @@ final class ZipPlatform
     /** @var int MS-DOS OS */
     /** @var int MS-DOS OS */
     public const OS_DOS = 0;
     public const OS_DOS = 0;
 
 
-    /** @var int Amica OS */
+    /** @var int Amiga OS */
     public const OS_AMIGA = 1;
     public const OS_AMIGA = 1;
 
 
     /** @var int OpenVMS */
     /** @var int OpenVMS */
@@ -51,6 +51,7 @@ final class ZipPlatform
 
 
     /** @var int VSE */
     /** @var int VSE */
     public const OS_VSE = 12;
     public const OS_VSE = 12;
+
     public const OS_QDOS = 12;
     public const OS_QDOS = 12;
 
 
     /** @var int Acorn RISC OS */
     /** @var int Acorn RISC OS */

+ 1 - 1
src/Exception/ZipCryptoException.php

@@ -12,7 +12,7 @@ declare(strict_types=1);
 namespace PhpZip\Exception;
 namespace PhpZip\Exception;
 
 
 /**
 /**
- * Thrown if there is an issue when reading or writing an encrypted ZIP file
+ * Thrown when reading or writing an encrypted ZIP file fails.
  * or entry.
  * or entry.
  */
  */
 class ZipCryptoException extends ZipException
 class ZipCryptoException extends ZipException

+ 2 - 5
src/Exception/ZipEntryNotFoundException.php

@@ -14,19 +14,16 @@ namespace PhpZip\Exception;
 use PhpZip\Model\ZipEntry;
 use PhpZip\Model\ZipEntry;
 
 
 /**
 /**
- * Thrown if entry not found.
+ * Thrown when an entry is not found.
  */
  */
 class ZipEntryNotFoundException extends ZipException
 class ZipEntryNotFoundException extends ZipException
 {
 {
     private string $entryName;
     private string $entryName;
 
 
-    /**
-     * @param ZipEntry|string $entryName
-     */
     public function __construct($entryName)
     public function __construct($entryName)
     {
     {
         $entryName = $entryName instanceof ZipEntry ? $entryName->getName() : $entryName;
         $entryName = $entryName instanceof ZipEntry ? $entryName->getName() : $entryName;
-        parent::__construct(sprintf(
+        parent::__construct(\sprintf(
             'Zip Entry "%s" was not found in the archive.',
             'Zip Entry "%s" was not found in the archive.',
             $entryName
             $entryName
         ));
         ));

+ 2 - 2
src/IO/Filter/Cipher/Pkware/PKCryptContext.php

@@ -26,7 +26,7 @@ class PKCryptContext
     public const STD_DEC_HDR_SIZE = 12;
     public const STD_DEC_HDR_SIZE = 12;
 
 
     /**
     /**
-     * Crc table.
+     * CRC table.
      *
      *
      * @var int[]|array
      * @var int[]|array
      */
      */
@@ -361,7 +361,7 @@ class PKCryptContext
     }
     }
 
 
     /**
     /**
-     * Update crc.
+     * Update the CRC.
      */
      */
     private function crc32(int $oldCrc, int $charAt): int
     private function crc32(int $oldCrc, int $charAt): int
     {
     {

+ 2 - 1
src/IO/Filter/Cipher/Pkware/PKDecryptionStreamFilter.php

@@ -15,7 +15,7 @@ use PhpZip\Exception\ZipAuthenticationException;
 use PhpZip\Model\ZipEntry;
 use PhpZip\Model\ZipEntry;
 
 
 /**
 /**
- * Decryption PKWARE Traditional Encryption.
+ * PKWARE traditional encryption decryption filter.
  */
  */
 class PKDecryptionStreamFilter extends \php_user_filter
 class PKDecryptionStreamFilter extends \php_user_filter
 {
 {
@@ -78,6 +78,7 @@ class PKDecryptionStreamFilter extends \php_user_filter
      * Decryption filter.
      * Decryption filter.
      *
      *
      * @todo USE FFI in php 7.4
      * @todo USE FFI in php 7.4
+     *
      * @noinspection PhpDocSignatureInspection
      * @noinspection PhpDocSignatureInspection
      *
      *
      * @param mixed $in
      * @param mixed $in

+ 1 - 1
src/IO/Filter/Cipher/Pkware/PKEncryptionStreamFilter.php

@@ -15,7 +15,7 @@ use PhpZip\Exception\RuntimeException;
 use PhpZip\Model\ZipEntry;
 use PhpZip\Model\ZipEntry;
 
 
 /**
 /**
- * Encryption PKWARE Traditional Encryption.
+ * PKWARE traditional encryption filter.
  */
  */
 class PKEncryptionStreamFilter extends \php_user_filter
 class PKEncryptionStreamFilter extends \php_user_filter
 {
 {

+ 1 - 1
src/IO/Stream/ResponseStream.php

@@ -14,7 +14,7 @@ namespace PhpZip\IO\Stream;
 use Psr\Http\Message\StreamInterface;
 use Psr\Http\Message\StreamInterface;
 
 
 /**
 /**
- * Implement PSR Message Stream.
+ * Implements a PSR-7 message stream.
  */
  */
 class ResponseStream implements StreamInterface
 class ResponseStream implements StreamInterface
 {
 {

+ 16 - 16
src/IO/ZipReader.php

@@ -81,13 +81,13 @@ class ZipReader
                 || (isset($meta['uri']) && is_dir($meta['uri']))
                 || (isset($meta['uri']) && is_dir($meta['uri']))
             )
             )
         ) {
         ) {
-            throw new InvalidArgumentException('Directory stream not supported');
+            throw new InvalidArgumentException('Directory streams are not supported');
         }
         }
 
 
         $seekable = $meta['seekable'];
         $seekable = $meta['seekable'];
 
 
         if (!$seekable) {
         if (!$seekable) {
-            throw new InvalidArgumentException('Resource does not support seekable.');
+            throw new InvalidArgumentException('The resource is not seekable.');
         }
         }
         $this->size = fstat($inStream)['size'];
         $this->size = fstat($inStream)['size'];
         $this->inStream = $inStream;
         $this->inStream = $inStream;
@@ -194,7 +194,7 @@ class ZipReader
             && unpack('V', fread($this->inStream, 4))[1] === ZipConstants::ZIP64_END_CD_LOC
             && unpack('V', fread($this->inStream, 4))[1] === ZipConstants::ZIP64_END_CD_LOC
         ) {
         ) {
             if (!$this->isZip64Support()) {
             if (!$this->isZip64Support()) {
-                throw new ZipException('ZIP64 not supported this archive.');
+                throw new ZipException('ZIP64 is not supported for this archive.');
             }
             }
 
 
             $positionECD = $this->findZip64ECDPosition();
             $positionECD = $this->findZip64ECDPosition();
@@ -297,9 +297,9 @@ class ZipReader
         }
         }
 
 
         [
         [
-//            'size' => $size,
-//            'versionMadeBy' => $versionMadeBy,
-//            'extractVersion' => $extractVersion,
+            //            'size' => $size,
+            //            'versionMadeBy' => $versionMadeBy,
+            //            'extractVersion' => $extractVersion,
             'diskNo' => $diskNo,
             'diskNo' => $diskNo,
             'cdDiskNo' => $cdDiskNo,
             'cdDiskNo' => $cdDiskNo,
             'cdEntriesDisk' => $cdEntriesDisk,
             'cdEntriesDisk' => $cdEntriesDisk,
@@ -612,7 +612,7 @@ class ZipReader
         fseek($this->inStream, $offsetLocalHeader);
         fseek($this->inStream, $offsetLocalHeader);
 
 
         if (unpack('V', fread($this->inStream, 4))[1] !== ZipConstants::LOCAL_FILE_HEADER) {
         if (unpack('V', fread($this->inStream, 4))[1] !== ZipConstants::LOCAL_FILE_HEADER) {
-            throw new ZipException(sprintf('%s (expected Local File Header)', $entry->getName()));
+            throw new ZipException(\sprintf('%s (expected Local File Header)', $entry->getName()));
         }
         }
 
 
         fseek($this->inStream, $offsetLocalHeader + ZipConstants::LFH_FILENAME_LENGTH_POS);
         fseek($this->inStream, $offsetLocalHeader + ZipConstants::LFH_FILENAME_LENGTH_POS);
@@ -647,7 +647,7 @@ class ZipReader
 
 
                 if ($extraField === null) {
                 if ($extraField === null) {
                     throw new ZipException(
                     throw new ZipException(
-                        sprintf(
+                        \sprintf(
                             'Extra field 0x%04x (WinZip-AES Encryption) expected for compression method %d',
                             'Extra field 0x%04x (WinZip-AES Encryption) expected for compression method %d',
                             WinZipAesExtraField::HEADER_ID,
                             WinZipAesExtraField::HEADER_ID,
                             $zipEntry->getCompressionMethod()
                             $zipEntry->getCompressionMethod()
@@ -696,7 +696,7 @@ class ZipReader
     public function copyUncompressedDataToStream(ZipSourceFileData $zipFileData, $outStream): void
     public function copyUncompressedDataToStream(ZipSourceFileData $zipFileData, $outStream): void
     {
     {
         if (!\is_resource($outStream)) {
         if (!\is_resource($outStream)) {
-            throw new InvalidArgumentException('outStream is not resource');
+            throw new InvalidArgumentException('outStream is not a resource');
         }
         }
 
 
         $entry = $zipFileData->getSourceEntry();
         $entry = $zipFileData->getSourceEntry();
@@ -706,7 +706,7 @@ class ZipReader
 //        }
 //        }
 
 
         if ($entry->isStrongEncryption()) {
         if ($entry->isStrongEncryption()) {
-            throw new ZipException('Not support encryption zip.');
+            throw new ZipException('Strong encryption is not supported.');
         }
         }
 
 
         $compressionMethod = $entry->getCompressionMethod();
         $compressionMethod = $entry->getCompressionMethod();
@@ -720,7 +720,7 @@ class ZipReader
 
 
         if ($isEncrypted) {
         if ($isEncrypted) {
             if ($entry->getPassword() === null) {
             if ($entry->getPassword() === null) {
-                throw new ZipException('Can not password from entry ' . $entry->getName());
+                throw new ZipException('Cannot get the password for entry ' . $entry->getName());
             }
             }
 
 
             if (ZipEncryptionMethod::isWinZipAesMethod($entry->getEncryptionMethod())) {
             if (ZipEncryptionMethod::isWinZipAesMethod($entry->getEncryptionMethod())) {
@@ -729,7 +729,7 @@ class ZipReader
 
 
                 if ($winZipAesExtra === null) {
                 if ($winZipAesExtra === null) {
                     throw new ZipException(
                     throw new ZipException(
-                        sprintf('WinZip AES must contain the extra field %s', WinZipAesExtraField::HEADER_ID)
+                        \sprintf('WinZip AES must contain the extra field %s', WinZipAesExtraField::HEADER_ID)
                     );
                     );
                 }
                 }
                 $compressionMethod = $winZipAesExtra->getCompressionMethod();
                 $compressionMethod = $winZipAesExtra->getCompressionMethod();
@@ -796,7 +796,7 @@ class ZipReader
 
 
             default:
             default:
                 throw new ZipException(
                 throw new ZipException(
-                    sprintf(
+                    \sprintf(
                         '%s (compression method %d (%s) is not supported)',
                         '%s (compression method %d (%s) is not supported)',
                         $entry->getName(),
                         $entry->getName(),
                         $compressionMethod,
                         $compressionMethod,
@@ -818,7 +818,7 @@ class ZipReader
             set_error_handler(
             set_error_handler(
                 static function (int $errorNumber, string $errorString) use ($entry): bool {
                 static function (int $errorNumber, string $errorString) use ($entry): bool {
                     throw new ZipException(
                     throw new ZipException(
-                        sprintf(
+                        \sprintf(
                             'Error reading the contents of entry "%s". %s',
                             'Error reading the contents of entry "%s". %s',
                             $entry->getName(),
                             $entry->getName(),
                             $errorString
                             $errorString
@@ -835,7 +835,7 @@ class ZipReader
                     $buffer = fread($this->inStream, $length);
                     $buffer = fread($this->inStream, $length);
 
 
                     if ($buffer === false) {
                     if ($buffer === false) {
-                        throw new ZipException(sprintf('Error reading the contents of entry "%s".', $entry->getName()));
+                        throw new ZipException(\sprintf('Error reading the contents of entry "%s".', $entry->getName()));
                     }
                     }
                     fwrite($outStream, $buffer);
                     fwrite($outStream, $buffer);
                     $offset += $length;
                     $offset += $length;
@@ -848,7 +848,7 @@ class ZipReader
                     $buffer = fread($this->inStream, $length);
                     $buffer = fread($this->inStream, $length);
 
 
                     if ($buffer === false) {
                     if ($buffer === false) {
-                        throw new ZipException(sprintf('Error reading the contents of entry "%s".', $entry->getName()));
+                        throw new ZipException(\sprintf('Error reading the contents of entry "%s".', $entry->getName()));
                     }
                     }
                     fwrite($outStream, $buffer);
                     fwrite($outStream, $buffer);
                     hash_update($contextHash, $buffer);
                     hash_update($contextHash, $buffer);

+ 3 - 2
src/Model/Data/ZipNewData.php

@@ -16,7 +16,7 @@ use PhpZip\Model\ZipEntry;
 use PhpZip\ZipFile;
 use PhpZip\ZipFile;
 
 
 /**
 /**
- * The class contains a streaming resource with new content added to the ZIP archive.
+ * Holds a stream resource with new content to be added to the ZIP archive.
  */
  */
 class ZipNewData implements ZipData
 class ZipNewData implements ZipData
 {
 {
@@ -35,6 +35,7 @@ class ZipNewData implements ZipData
 
 
     /**
     /**
      * @param string|resource $data Raw string data or resource
      * @param string|resource $data Raw string data or resource
+     *
      * @noinspection PhpMissingParamTypeInspection
      * @noinspection PhpMissingParamTypeInspection
      */
      */
     public function __construct(ZipEntry $zipEntry, $data)
     public function __construct(ZipEntry $zipEntry, $data)
@@ -69,7 +70,7 @@ class ZipNewData implements ZipData
     public function getDataAsStream()
     public function getDataAsStream()
     {
     {
         if (!\is_resource($this->stream)) {
         if (!\is_resource($this->stream)) {
-            throw new \LogicException(sprintf('Resource has been closed (entry=%s).', $this->zipEntry->getName()));
+            throw new \LogicException(\sprintf('Resource has been closed (entry=%s).', $this->zipEntry->getName()));
         }
         }
 
 
         return $this->stream;
         return $this->stream;

+ 2 - 2
src/Model/Extra/Fields/AbstractUnicodeExtraField.php

@@ -16,7 +16,7 @@ use PhpZip\Model\Extra\ZipExtraField;
 use PhpZip\Model\ZipEntry;
 use PhpZip\Model\ZipEntry;
 
 
 /**
 /**
- * A common base class for Unicode extra information extra fields.
+ * A common base class for the Info-ZIP Unicode path and comment extra fields.
  */
  */
 abstract class AbstractUnicodeExtraField implements ZipExtraField
 abstract class AbstractUnicodeExtraField implements ZipExtraField
 {
 {
@@ -81,7 +81,7 @@ abstract class AbstractUnicodeExtraField implements ZipExtraField
         ] = unpack('Cversion/Vcrc32', $buffer);
         ] = unpack('Cversion/Vcrc32', $buffer);
 
 
         if ($version !== self::DEFAULT_VERSION) {
         if ($version !== self::DEFAULT_VERSION) {
-            throw new ZipException(sprintf('Unsupported version [%d] for Unicode path extra data.', $version));
+            throw new ZipException(\sprintf('Unsupported version [%d] for Unicode path extra data.', $version));
         }
         }
 
 
         $unicodeValue = substr($buffer, 5);
         $unicodeValue = substr($buffer, 5);

+ 2 - 6
src/Model/Extra/Fields/AsiExtraField.php

@@ -103,8 +103,6 @@ final class AsiExtraField implements ZipExtraField
      * @param ZipEntry|null $entry  optional zip entry
      * @param ZipEntry|null $entry  optional zip entry
      *
      *
      * @throws Crc32Exception
      * @throws Crc32Exception
-     *
-     * @return AsiExtraField
      */
      */
     public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self
     public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self
     {
     {
@@ -113,7 +111,7 @@ final class AsiExtraField implements ZipExtraField
         $realChecksum = crc32($buffer);
         $realChecksum = crc32($buffer);
 
 
         if ($givenChecksum !== $realChecksum) {
         if ($givenChecksum !== $realChecksum) {
-            throw new Crc32Exception('Asi Unix Extra Filed Data', $givenChecksum, $realChecksum);
+            throw new Crc32Exception('Asi Unix Extra Field Data', $givenChecksum, $realChecksum);
         }
         }
 
 
         [
         [
@@ -138,8 +136,6 @@ final class AsiExtraField implements ZipExtraField
      * @param ZipEntry|null $entry  optional zip entry
      * @param ZipEntry|null $entry  optional zip entry
      *
      *
      * @throws Crc32Exception
      * @throws Crc32Exception
-     *
-     * @return AsiExtraField
      */
      */
     public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self
     public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self
     {
     {
@@ -273,7 +269,7 @@ final class AsiExtraField implements ZipExtraField
 
 
     public function __toString(): string
     public function __toString(): string
     {
     {
-        return sprintf(
+        return \sprintf(
             '0x%04x ASI: Mode=%o UID=%d GID=%d Link="%s',
             '0x%04x ASI: Mode=%o UID=%d GID=%d Link="%s',
             self::HEADER_ID,
             self::HEADER_ID,
             $this->mode,
             $this->mode,

+ 1 - 12
src/Model/Extra/Fields/ExtendedTimestampExtraField.php

@@ -119,13 +119,6 @@ final class ExtendedTimestampExtraField implements ZipExtraField
         $this->createTime = $createTime;
         $this->createTime = $createTime;
     }
     }
 
 
-    /**
-     * @param ?int $modifyTime
-     * @param ?int $accessTime
-     * @param ?int $createTime
-     *
-     * @return ExtendedTimestampExtraField
-     */
     public static function create(?int $modifyTime, ?int $accessTime, ?int $createTime): self
     public static function create(?int $modifyTime, ?int $accessTime, ?int $createTime): self
     {
     {
         $flags = 0;
         $flags = 0;
@@ -160,8 +153,6 @@ final class ExtendedTimestampExtraField implements ZipExtraField
      *
      *
      * @param string        $buffer the buffer to read data from
      * @param string        $buffer the buffer to read data from
      * @param ZipEntry|null $entry  optional zip entry
      * @param ZipEntry|null $entry  optional zip entry
-     *
-     * @return ExtendedTimestampExtraField
      */
      */
     public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self
     public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self
     {
     {
@@ -197,8 +188,6 @@ final class ExtendedTimestampExtraField implements ZipExtraField
      *
      *
      * @param string        $buffer the buffer to read data from
      * @param string        $buffer the buffer to read data from
      * @param ZipEntry|null $entry  optional zip entry
      * @param ZipEntry|null $entry  optional zip entry
-     *
-     * @return ExtendedTimestampExtraField
      */
      */
     public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self
     public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self
     {
     {
@@ -331,7 +320,7 @@ final class ExtendedTimestampExtraField implements ZipExtraField
     }
     }
 
 
     /**
     /**
-     * Returns the create time as a a \DateTimeInterface
+     * Returns the create time as a \DateTimeInterface
      * of this zip entry, or null if no such timestamp exists in the zip entry.
      * of this zip entry, or null if no such timestamp exists in the zip entry.
      * The milliseconds are always zeroed out, since the underlying data
      * The milliseconds are always zeroed out, since the underlying data
      * offers only per-second precision.
      * offers only per-second precision.

+ 2 - 9
src/Model/Extra/Fields/NtfsExtraField.php

@@ -56,9 +56,6 @@ final class NtfsExtraField implements ZipExtraField
         $this->createNtfsTime = $createNtfsTime;
         $this->createNtfsTime = $createNtfsTime;
     }
     }
 
 
-    /**
-     * @return NtfsExtraField
-     */
     public static function create(
     public static function create(
         \DateTimeInterface $modifyDateTime,
         \DateTimeInterface $modifyDateTime,
         \DateTimeInterface $accessDateTime,
         \DateTimeInterface $accessDateTime,
@@ -88,13 +85,11 @@ final class NtfsExtraField implements ZipExtraField
      * @param ZipEntry|null $entry  optional zip entry
      * @param ZipEntry|null $entry  optional zip entry
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return NtfsExtraField
      */
      */
     public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self
     public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self
     {
     {
         if (\PHP_INT_SIZE === 4) {
         if (\PHP_INT_SIZE === 4) {
-            throw new ZipException('not supported for php-32bit');
+            throw new ZipException('NTFS timestamps are not supported in 32-bit PHP.');
         }
         }
 
 
         $buffer = substr($buffer, 4);
         $buffer = substr($buffer, 4);
@@ -131,8 +126,6 @@ final class NtfsExtraField implements ZipExtraField
      * @param ZipEntry|null $entry  optional zip entry
      * @param ZipEntry|null $entry  optional zip entry
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return NtfsExtraField
      */
      */
     public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self
     public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self
     {
     {
@@ -253,7 +246,7 @@ final class NtfsExtraField implements ZipExtraField
     public static function ntfsTimeToDateTime(int $ntfsTime): \DateTimeInterface
     public static function ntfsTimeToDateTime(int $ntfsTime): \DateTimeInterface
     {
     {
         $timestamp = self::ntfsTimeToTimestamp($ntfsTime);
         $timestamp = self::ntfsTimeToTimestamp($ntfsTime);
-        $dateTime = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6f', $timestamp));
+        $dateTime = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6f', $timestamp));
 
 
         if ($dateTime === false) {
         if ($dateTime === false) {
             throw new InvalidArgumentException('Cannot create date/time object for timestamp ' . $timestamp);
             throw new InvalidArgumentException('Cannot create date/time object for timestamp ' . $timestamp);

+ 2 - 6
src/Model/Extra/Fields/UnrecognizedExtraField.php

@@ -51,12 +51,10 @@ final class UnrecognizedExtraField implements ZipExtraField
      *
      *
      * @param string        $buffer the buffer to read data from
      * @param string        $buffer the buffer to read data from
      * @param ZipEntry|null $entry  optional zip entry
      * @param ZipEntry|null $entry  optional zip entry
-     *
-     * @return UnrecognizedExtraField
      */
      */
     public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self
     public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self
     {
     {
-        throw new RuntimeException('Unsupport parse');
+        throw new RuntimeException('Parsing is not supported for unrecognized extra fields.');
     }
     }
 
 
     /**
     /**
@@ -64,12 +62,10 @@ final class UnrecognizedExtraField implements ZipExtraField
      *
      *
      * @param string        $buffer the buffer to read data from
      * @param string        $buffer the buffer to read data from
      * @param ZipEntry|null $entry  optional zip entry
      * @param ZipEntry|null $entry  optional zip entry
-     *
-     * @return UnrecognizedExtraField
      */
      */
     public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self
     public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self
     {
     {
-        throw new RuntimeException('Unsupport parse');
+        throw new RuntimeException('Parsing is not supported for unrecognized extra fields.');
     }
     }
 
 
     /**
     /**

+ 10 - 18
src/Model/Extra/Fields/WinZipAesExtraField.php

@@ -107,15 +107,13 @@ final class WinZipAesExtraField implements ZipExtraField
 
 
     /**
     /**
      * @throws ZipUnsupportMethodException
      * @throws ZipUnsupportMethodException
-     *
-     * @return WinZipAesExtraField
      */
      */
     public static function create(ZipEntry $entry): self
     public static function create(ZipEntry $entry): self
     {
     {
         $keyStrength = array_search($entry->getEncryptionMethod(), self::MAP_KEY_STRENGTH_METHODS, true);
         $keyStrength = array_search($entry->getEncryptionMethod(), self::MAP_KEY_STRENGTH_METHODS, true);
 
 
         if ($keyStrength === false) {
         if ($keyStrength === false) {
-            throw new InvalidArgumentException('Not support encryption method ' . $entry->getEncryptionMethod());
+            throw new InvalidArgumentException('Unsupported encryption method ' . $entry->getEncryptionMethod());
         }
         }
 
 
         // WinZip 11 will continue to use AE-2, with no CRC, for very small files
         // WinZip 11 will continue to use AE-2, with no CRC, for very small files
@@ -152,12 +150,9 @@ final class WinZipAesExtraField implements ZipExtraField
     /**
     /**
      * Populate data from this array as if it was in local file data.
      * Populate data from this array as if it was in local file data.
      *
      *
-     * @param string    $buffer the buffer to read data from
-     * @param ?ZipEntry $entry
+     * @param string $buffer the buffer to read data from
      *
      *
      * @throws ZipException on error
      * @throws ZipException on error
-     *
-     * @return WinZipAesExtraField
      */
      */
     public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self
     public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self
     {
     {
@@ -165,7 +160,7 @@ final class WinZipAesExtraField implements ZipExtraField
 
 
         if ($size !== self::DATA_SIZE) {
         if ($size !== self::DATA_SIZE) {
             throw new ZipException(
             throw new ZipException(
-                sprintf(
+                \sprintf(
                     'WinZip AES Extra data invalid size: %d. Must be %d',
                     'WinZip AES Extra data invalid size: %d. Must be %d',
                     $size,
                     $size,
                     self::DATA_SIZE
                     self::DATA_SIZE
@@ -182,7 +177,7 @@ final class WinZipAesExtraField implements ZipExtraField
 
 
         if ($vendorId !== self::VENDOR_ID) {
         if ($vendorId !== self::VENDOR_ID) {
             throw new ZipException(
             throw new ZipException(
-                sprintf(
+                \sprintf(
                     'Vendor id invalid: %d. Must be %d',
                     'Vendor id invalid: %d. Must be %d',
                     $vendorId,
                     $vendorId,
                     self::VENDOR_ID
                     self::VENDOR_ID
@@ -196,12 +191,9 @@ final class WinZipAesExtraField implements ZipExtraField
     /**
     /**
      * Populate data from this array as if it was in central directory data.
      * Populate data from this array as if it was in central directory data.
      *
      *
-     * @param string    $buffer the buffer to read data from
-     * @param ?ZipEntry $entry
+     * @param string $buffer the buffer to read data from
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return WinZipAesExtraField
      */
      */
     public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self
     public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self
     {
     {
@@ -259,8 +251,8 @@ final class WinZipAesExtraField implements ZipExtraField
     {
     {
         if (!\in_array($vendorVersion, self::ALLOW_VENDOR_VERSIONS, true)) {
         if (!\in_array($vendorVersion, self::ALLOW_VENDOR_VERSIONS, true)) {
             throw new InvalidArgumentException(
             throw new InvalidArgumentException(
-                sprintf(
-                    'Unsupport WinZip AES vendor version: %d',
+                \sprintf(
+                    'Unsupported WinZip AES vendor version: %d',
                     $vendorVersion
                     $vendorVersion
                 )
                 )
             );
             );
@@ -288,8 +280,8 @@ final class WinZipAesExtraField implements ZipExtraField
     {
     {
         if (!isset(self::ENCRYPTION_STRENGTHS[$keyStrength])) {
         if (!isset(self::ENCRYPTION_STRENGTHS[$keyStrength])) {
             throw new InvalidArgumentException(
             throw new InvalidArgumentException(
-                sprintf(
-                    'Key strength %d not support value. Allow values: %s',
+                \sprintf(
+                    'Invalid key strength %d. Allowed values: %s',
                     $keyStrength,
                     $keyStrength,
                     implode(', ', array_keys(self::ENCRYPTION_STRENGTHS))
                     implode(', ', array_keys(self::ENCRYPTION_STRENGTHS))
                 )
                 )
@@ -345,7 +337,7 @@ final class WinZipAesExtraField implements ZipExtraField
 
 
     public function __toString(): string
     public function __toString(): string
     {
     {
-        return sprintf(
+        return \sprintf(
             '0x%04x WINZIP AES: VendorVersion=%d KeyStrength=0x%02x CompressionMethod=%s',
             '0x%04x WINZIP AES: VendorVersion=%d KeyStrength=0x%02x CompressionMethod=%s',
             __CLASS__,
             __CLASS__,
             $this->vendorVersion,
             $this->vendorVersion,

+ 10 - 23
src/Model/ZipContainer.php

@@ -54,9 +54,6 @@ class ZipContainer extends ImmutableZipContainer
         $this->entries[$entry->getName()] = $entry;
         $this->entries[$entry->getName()] = $entry;
     }
     }
 
 
-    /**
-     * @param string|ZipEntry $entry
-     */
     public function deleteEntry($entry): bool
     public function deleteEntry($entry): bool
     {
     {
         $entry = $entry instanceof ZipEntry ? $entry->getName() : (string) $entry;
         $entry = $entry instanceof ZipEntry ? $entry->getName() : (string) $entry;
@@ -71,8 +68,8 @@ class ZipContainer extends ImmutableZipContainer
     }
     }
 
 
     /**
     /**
-     * @param string|ZipEntry $old
-     * @param string|ZipEntry $new
+     * @param mixed $old
+     * @param mixed $new
      *
      *
      * @throws ZipException
      * @throws ZipException
      *
      *
@@ -84,7 +81,7 @@ class ZipContainer extends ImmutableZipContainer
         $new = $new instanceof ZipEntry ? $new->getName() : (string) $new;
         $new = $new instanceof ZipEntry ? $new->getName() : (string) $new;
 
 
         if (isset($this->entries[$new])) {
         if (isset($this->entries[$new])) {
-            throw new InvalidArgumentException('New entry name ' . $new . ' is exists.');
+            throw new InvalidArgumentException('New entry name "' . $new . '" already exists.');
         }
         }
 
 
         $entry = $this->getEntry($old);
         $entry = $this->getEntry($old);
@@ -97,7 +94,7 @@ class ZipContainer extends ImmutableZipContainer
     }
     }
 
 
     /**
     /**
-     * @param string|ZipEntry $entryName
+     * @param mixed $entryName
      *
      *
      * @throws ZipEntryNotFoundException
      * @throws ZipEntryNotFoundException
      */
      */
@@ -112,9 +109,6 @@ class ZipContainer extends ImmutableZipContainer
         throw new ZipEntryNotFoundException($entryName);
         throw new ZipEntryNotFoundException($entryName);
     }
     }
 
 
-    /**
-     * @param string|ZipEntry $entryName
-     */
     public function getEntryOrNull($entryName): ?ZipEntry
     public function getEntryOrNull($entryName): ?ZipEntry
     {
     {
         $entryName = $entryName instanceof ZipEntry ? $entryName->getName() : (string) $entryName;
         $entryName = $entryName instanceof ZipEntry ? $entryName->getName() : (string) $entryName;
@@ -122,9 +116,6 @@ class ZipContainer extends ImmutableZipContainer
         return $this->entries[$entryName] ?? null;
         return $this->entries[$entryName] ?? null;
     }
     }
 
 
-    /**
-     * @param string|ZipEntry $entryName
-     */
     public function hasEntry($entryName): bool
     public function hasEntry($entryName): bool
     {
     {
         $entryName = $entryName instanceof ZipEntry ? $entryName->getName() : (string) $entryName;
         $entryName = $entryName instanceof ZipEntry ? $entryName->getName() : (string) $entryName;
@@ -170,7 +161,7 @@ class ZipContainer extends ImmutableZipContainer
     }
     }
 
 
     /**
     /**
-     * Undo all changes done in the archive.
+     * Undo all changes made to the archive.
      */
      */
     public function unchangeAll(): void
     public function unchangeAll(): void
     {
     {
@@ -197,7 +188,7 @@ class ZipContainer extends ImmutableZipContainer
     }
     }
 
 
     /**
     /**
-     * Revert all changes done to an entry with the given name.
+     * Revert all changes made to an entry with the given name.
      *
      *
      * @param string|ZipEntry $entry Entry name or ZipEntry
      * @param string|ZipEntry $entry Entry name or ZipEntry
      */
      */
@@ -218,7 +209,7 @@ class ZipContainer extends ImmutableZipContainer
     }
     }
 
 
     /**
     /**
-     * Entries sort by name.
+     * Sort entries by name using the given comparison function.
      *
      *
      * Example:
      * Example:
      * ```php
      * ```php
@@ -233,7 +224,7 @@ class ZipContainer extends ImmutableZipContainer
     }
     }
 
 
     /**
     /**
-     * Entries sort by entry.
+     * Sort entries using the given comparison function.
      *
      *
      * Example:
      * Example:
      * ```php
      * ```php
@@ -253,7 +244,7 @@ class ZipContainer extends ImmutableZipContainer
             $length = \strlen($archiveComment);
             $length = \strlen($archiveComment);
 
 
             if ($length > 0xFFFF) {
             if ($length > 0xFFFF) {
-                throw new InvalidArgumentException('Length comment out of range');
+                throw new InvalidArgumentException('Comment length out of range');
             }
             }
         }
         }
         $this->archiveComment = $archiveComment;
         $this->archiveComment = $archiveComment;
@@ -266,8 +257,6 @@ class ZipContainer extends ImmutableZipContainer
 
 
     /**
     /**
      * Specify a password for extracting files.
      * Specify a password for extracting files.
-     *
-     * @param ?string $password
      */
      */
     public function setReadPassword(?string $password): void
     public function setReadPassword(?string $password): void
     {
     {
@@ -296,8 +285,6 @@ class ZipContainer extends ImmutableZipContainer
     }
     }
 
 
     /**
     /**
-     * @param ?string $writePassword
-     *
      * @throws ZipEntryNotFoundException
      * @throws ZipEntryNotFoundException
      */
      */
     public function setWritePassword(?string $writePassword): void
     public function setWritePassword(?string $writePassword): void
@@ -316,7 +303,7 @@ class ZipContainer extends ImmutableZipContainer
     }
     }
 
 
     /**
     /**
-     * @param string|ZipEntry $entryName
+     * @param mixed $entryName
      *
      *
      * @throws ZipEntryNotFoundException
      * @throws ZipEntryNotFoundException
      */
      */

+ 9 - 80
src/Model/ZipEntry.php

@@ -94,14 +94,14 @@ class ZipEntry
     private int $localHeaderOffset = 0;
     private int $localHeaderOffset = 0;
 
 
     /**
     /**
-     * Collections of Extra Fields in Central Directory.
+     * Collections of extra fields in the central directory.
      * Keys from Header ID [int] and value Extra Field [ExtraField].
      * Keys from Header ID [int] and value Extra Field [ExtraField].
      */
      */
     protected ExtraFieldsCollection $cdExtraFields;
     protected ExtraFieldsCollection $cdExtraFields;
 
 
     /**
     /**
-     * Collections of Extra Fields int local header.
-     * Keys from Header ID [int] and value Extra Field [ExtraField].
+     * Collections of extra fields in the local header.
+     * Keys are header IDs [int] and values are extra fields [ExtraField].
      */
      */
     protected ExtraFieldsCollection $localExtraFields;
     protected ExtraFieldsCollection $localExtraFields;
 
 
@@ -133,16 +133,11 @@ class ZipEntry
     }
     }
 
 
     /**
     /**
-     * This method only internal use.
+     * This method is for internal use only.
      *
      *
      * @internal
      * @internal
      *
      *
      * @noinspection PhpTooManyParametersInspection
      * @noinspection PhpTooManyParametersInspection
-     *
-     * @param ?string $comment
-     * @param ?string $charset
-     *
-     * @return ZipEntry
      */
      */
     public static function create(
     public static function create(
         string $name,
         string $name,
@@ -188,8 +183,6 @@ class ZipEntry
      *
      *
      * @param string      $name    New entry name
      * @param string      $name    New entry name
      * @param string|null $charset Entry name charset
      * @param string|null $charset Entry name charset
-     *
-     * @return ZipEntry
      */
      */
     private function setName(string $name, ?string $charset = null): self
     private function setName(string $name, ?string $charset = null): self
     {
     {
@@ -228,10 +221,6 @@ class ZipEntry
 
 
     /**
     /**
      * @see DosCodePage::getCodePages()
      * @see DosCodePage::getCodePages()
-     *
-     * @param ?string $charset
-     *
-     * @return ZipEntry
      */
      */
     public function setCharset(?string $charset = null): self
     public function setCharset(?string $charset = null): self
     {
     {
@@ -293,8 +282,6 @@ class ZipEntry
 
 
     /**
     /**
      * Set platform.
      * Set platform.
-     *
-     * @return ZipEntry
      */
      */
     public function setCreatedOS(int $platform): self
     public function setCreatedOS(int $platform): self
     {
     {
@@ -313,8 +300,6 @@ class ZipEntry
 
 
     /**
     /**
      * Set extracted OS.
      * Set extracted OS.
-     *
-     * @return ZipEntry
      */
      */
     public function setExtractedOS(int $platform): self
     public function setExtractedOS(int $platform): self
     {
     {
@@ -335,9 +320,6 @@ class ZipEntry
         return $this->softwareVersion;
         return $this->softwareVersion;
     }
     }
 
 
-    /**
-     * @return ZipEntry
-     */
     public function setSoftwareVersion(int $softwareVersion): self
     public function setSoftwareVersion(int $softwareVersion): self
     {
     {
         $this->softwareVersion = $softwareVersion;
         $this->softwareVersion = $softwareVersion;
@@ -379,8 +361,6 @@ class ZipEntry
 
 
     /**
     /**
      * Set version needed to extract.
      * Set version needed to extract.
-     *
-     * @return ZipEntry
      */
      */
     public function setExtractVersion(int $version): self
     public function setExtractVersion(int $version): self
     {
     {
@@ -402,8 +382,6 @@ class ZipEntry
      *
      *
      * @param int $compressedSize the Compressed Size
      * @param int $compressedSize the Compressed Size
      *
      *
-     * @return ZipEntry
-     *
      * @internal
      * @internal
      */
      */
     public function setCompressedSize(int $compressedSize): self
     public function setCompressedSize(int $compressedSize): self
@@ -429,8 +407,6 @@ class ZipEntry
      *
      *
      * @param int $uncompressedSize the (Uncompressed) Size
      * @param int $uncompressedSize the (Uncompressed) Size
      *
      *
-     * @return ZipEntry
-     *
      * @internal
      * @internal
      */
      */
     public function setUncompressedSize(int $uncompressedSize): self
     public function setUncompressedSize(int $uncompressedSize): self
@@ -452,8 +428,6 @@ class ZipEntry
     }
     }
 
 
     /**
     /**
-     * @return ZipEntry
-     *
      * @internal
      * @internal
      */
      */
     public function setLocalHeaderOffset(int $localHeaderOffset): self
     public function setLocalHeaderOffset(int $localHeaderOffset): self
@@ -479,8 +453,6 @@ class ZipEntry
      *
      *
      * @param int $gpbf general purpose bit flags
      * @param int $gpbf general purpose bit flags
      *
      *
-     * @return ZipEntry
-     *
      * @internal
      * @internal
      */
      */
     public function setGeneralPurposeBitFlags(int $gpbf): self
     public function setGeneralPurposeBitFlags(int $gpbf): self
@@ -512,9 +484,6 @@ class ZipEntry
         }
         }
     }
     }
 
 
-    /**
-     * @return ZipEntry
-     */
     private function setGeneralBitFlag(int $mask, bool $enable): self
     private function setGeneralBitFlag(int $mask, bool $enable): self
     {
     {
         if ($enable) {
         if ($enable) {
@@ -570,8 +539,6 @@ class ZipEntry
     /**
     /**
      * Sets the encryption property to false and removes any other
      * Sets the encryption property to false and removes any other
      * encryption artifacts.
      * encryption artifacts.
-     *
-     * @return ZipEntry
      */
      */
     public function disableEncryption(): self
     public function disableEncryption(): self
     {
     {
@@ -586,8 +553,6 @@ class ZipEntry
 
 
     /**
     /**
      * Sets the encryption flag for this ZIP entry.
      * Sets the encryption flag for this ZIP entry.
-     *
-     * @return ZipEntry
      */
      */
     private function setEncrypted(bool $encrypted): self
     private function setEncrypted(bool $encrypted): self
     {
     {
@@ -609,8 +574,6 @@ class ZipEntry
      *
      *
      * @throws ZipUnsupportMethodException
      * @throws ZipUnsupportMethodException
      *
      *
-     * @return ZipEntry
-     *
      * @see ZipCompressionMethod::STORED
      * @see ZipCompressionMethod::STORED
      * @see ZipCompressionMethod::DEFLATED
      * @see ZipCompressionMethod::DEFLATED
      * @see ZipCompressionMethod::BZIP2
      * @see ZipCompressionMethod::BZIP2
@@ -652,8 +615,6 @@ class ZipEntry
 
 
     /**
     /**
      * Set Dos Time.
      * Set Dos Time.
-     *
-     * @return ZipEntry
      */
      */
     public function setDosTime(int $dosTime): self
     public function setDosTime(int $dosTime): self
     {
     {
@@ -670,8 +631,6 @@ class ZipEntry
 
 
     /**
     /**
      * Set time from unix timestamp.
      * Set time from unix timestamp.
-     *
-     * @return ZipEntry
      */
      */
     public function setTime(int $unixTimestamp): self
     public function setTime(int $unixTimestamp): self
     {
     {
@@ -698,8 +657,6 @@ class ZipEntry
      * Sets the external file attributes.
      * Sets the external file attributes.
      *
      *
      * @param int $externalAttributes the external file attributes
      * @param int $externalAttributes the external file attributes
-     *
-     * @return ZipEntry
      */
      */
     public function setExternalAttributes(int $externalAttributes): self
     public function setExternalAttributes(int $externalAttributes): self
     {
     {
@@ -730,8 +687,6 @@ class ZipEntry
      * Sets the internal file attributes.
      * Sets the internal file attributes.
      *
      *
      * @param int $internalAttributes the internal file attributes
      * @param int $internalAttributes the internal file attributes
-     *
-     * @return ZipEntry
      */
      */
     public function setInternalAttributes(int $internalAttributes): self
     public function setInternalAttributes(int $internalAttributes): self
     {
     {
@@ -762,9 +717,6 @@ class ZipEntry
         return $this->cdExtraFields->get($headerId);
         return $this->cdExtraFields->get($headerId);
     }
     }
 
 
-    /**
-     * @return ZipEntry
-     */
     public function setCdExtraFields(ExtraFieldsCollection $cdExtraFields): self
     public function setCdExtraFields(ExtraFieldsCollection $cdExtraFields): self
     {
     {
         $this->cdExtraFields = $cdExtraFields;
         $this->cdExtraFields = $cdExtraFields;
@@ -782,9 +734,6 @@ class ZipEntry
         return $this->localExtraFields[$headerId];
         return $this->localExtraFields[$headerId];
     }
     }
 
 
-    /**
-     * @return ZipEntry
-     */
     public function setLocalExtraFields(ExtraFieldsCollection $localExtraFields): self
     public function setLocalExtraFields(ExtraFieldsCollection $localExtraFields): self
     {
     {
         $this->localExtraFields = $localExtraFields;
         $this->localExtraFields = $localExtraFields;
@@ -837,10 +786,6 @@ class ZipEntry
 
 
     /**
     /**
      * Set entry comment.
      * Set entry comment.
-     *
-     * @param ?string $comment
-     *
-     * @return ZipEntry
      */
      */
     public function setComment(?string $comment): self
     public function setComment(?string $comment): self
     {
     {
@@ -866,7 +811,7 @@ class ZipEntry
     }
     }
 
 
     /**
     /**
-     * Return crc32 content or 0 for WinZip AES v2.
+     * Returns the CRC32 of the content, or 0 for WinZip AES v2.
      */
      */
     public function getCrc(): int
     public function getCrc(): int
     {
     {
@@ -876,8 +821,6 @@ class ZipEntry
     /**
     /**
      * Set crc32 content.
      * Set crc32 content.
      *
      *
-     * @return ZipEntry
-     *
      * @internal
      * @internal
      */
      */
     public function setCrc(int $crc): self
     public function setCrc(int $crc): self
@@ -894,11 +837,6 @@ class ZipEntry
 
 
     /**
     /**
      * Set password and encryption method from entry.
      * Set password and encryption method from entry.
-     *
-     * @param ?string $password
-     * @param ?int    $encryptionMethod
-     *
-     * @return ZipEntry
      */
      */
     public function setPassword(?string $password, ?int $encryptionMethod = null): self
     public function setPassword(?string $password, ?int $encryptionMethod = null): self
     {
     {
@@ -936,10 +874,6 @@ class ZipEntry
      * @see ZipEncryptionMethod::WINZIP_AES_256
      * @see ZipEncryptionMethod::WINZIP_AES_256
      * @see ZipEncryptionMethod::WINZIP_AES_192
      * @see ZipEncryptionMethod::WINZIP_AES_192
      * @see ZipEncryptionMethod::WINZIP_AES_128
      * @see ZipEncryptionMethod::WINZIP_AES_128
-     *
-     * @param ?int $encryptionMethod
-     *
-     * @return ZipEntry
      */
      */
     public function setEncryptionMethod(?int $encryptionMethod): self
     public function setEncryptionMethod(?int $encryptionMethod): self
     {
     {
@@ -959,9 +893,6 @@ class ZipEntry
         return $this->compressionLevel;
         return $this->compressionLevel;
     }
     }
 
 
-    /**
-     * @return ZipEntry
-     */
     public function setCompressionLevel(int $compressionLevel): self
     public function setCompressionLevel(int $compressionLevel): self
     {
     {
         if ($compressionLevel === self::UNKNOWN) {
         if ($compressionLevel === self::UNKNOWN) {
@@ -985,7 +916,7 @@ class ZipEntry
     }
     }
 
 
     /**
     /**
-     * Update general purpose bit flogs.
+     * Update the general purpose bit flags.
      */
      */
     private function updateGbpfCompLevel(): void
     private function updateGbpfCompLevel(): void
     {
     {
@@ -1006,7 +937,7 @@ class ZipEntry
                     $bit1 = true;
                     $bit1 = true;
                     $bit2 = true;
                     $bit2 = true;
                     break;
                     break;
-                // default is ZipCompressionLevel::NORMAL
+                    // default is ZipCompressionLevel::NORMAL
             }
             }
 
 
             $this->generalPurposeBitFlags |= ($bit1 ? GeneralPurposeBitFlag::COMPRESSION_FLAG1 : 0);
             $this->generalPurposeBitFlags |= ($bit1 ? GeneralPurposeBitFlag::COMPRESSION_FLAG1 : 0);
@@ -1019,8 +950,6 @@ class ZipEntry
      * unzip command.
      * unzip command.
      *
      *
      * @param int $mode mode an int value
      * @param int $mode mode an int value
-     *
-     * @return ZipEntry
      */
      */
     public function setUnixMode(int $mode): self
     public function setUnixMode(int $mode): self
     {
     {
@@ -1037,7 +966,7 @@ class ZipEntry
     }
     }
 
 
     /**
     /**
-     * Unix permission.
+     * Unix permissions.
      *
      *
      * @return int the unix permissions
      * @return int the unix permissions
      */
      */
@@ -1111,7 +1040,7 @@ class ZipEntry
         try {
         try {
             return new \DateTimeImmutable('@' . $timestamp);
             return new \DateTimeImmutable('@' . $timestamp);
         } catch (\Exception $e) {
         } catch (\Exception $e) {
-            throw new RuntimeException('Error create DateTime object with timestamp ' . $timestamp, 1, $e);
+            throw new RuntimeException('Cannot create a DateTime object for timestamp ' . $timestamp, 1, $e);
         }
         }
     }
     }
 
 

+ 2 - 15
src/Model/ZipEntryMatcher.php

@@ -26,8 +26,6 @@ class ZipEntryMatcher implements \Countable
 
 
     /**
     /**
      * @param string|ZipEntry|string[]|ZipEntry[] $entries
      * @param string|ZipEntry|string[]|ZipEntry[] $entries
-     *
-     * @return ZipEntryMatcher
      */
      */
     public function add($entries): self
     public function add($entries): self
     {
     {
@@ -57,7 +55,6 @@ class ZipEntryMatcher implements \Countable
     }
     }
 
 
     /**
     /**
-     * @return ZipEntryMatcher
      * @noinspection PhpUnusedParameterInspection
      * @noinspection PhpUnusedParameterInspection
      */
      */
     public function match(string $regexp): self
     public function match(string $regexp): self
@@ -75,9 +72,6 @@ class ZipEntryMatcher implements \Countable
         return $this;
         return $this;
     }
     }
 
 
-    /**
-     * @return ZipEntryMatcher
-     */
     public function all(): self
     public function all(): self
     {
     {
         $this->matches = array_map(
         $this->matches = array_map(
@@ -89,17 +83,16 @@ class ZipEntryMatcher implements \Countable
     }
     }
 
 
     /**
     /**
-     * Callable function for all select entries.
+     * Call a function for all selected entries.
      *
      *
      * Callable function signature:
      * Callable function signature:
-     * function(string $entryName){}
+     * function (string $entryName): void
      */
      */
     public function invoke(callable $callable): void
     public function invoke(callable $callable): void
     {
     {
         if (!empty($this->matches)) {
         if (!empty($this->matches)) {
             array_walk(
             array_walk(
                 $this->matches,
                 $this->matches,
-                /** @param string $entryName */
                 static function (string $entryName) use ($callable): void {
                 static function (string $entryName) use ($callable): void {
                     $callable($entryName);
                     $callable($entryName);
                 }
                 }
@@ -116,7 +109,6 @@ class ZipEntryMatcher implements \Countable
     {
     {
         array_walk(
         array_walk(
             $this->matches,
             $this->matches,
-            /** @param string $entryName */
             function (string $entryName): void {
             function (string $entryName): void {
                 $this->zipContainer->deleteEntry($entryName);
                 $this->zipContainer->deleteEntry($entryName);
             }
             }
@@ -125,16 +117,12 @@ class ZipEntryMatcher implements \Countable
     }
     }
 
 
     /**
     /**
-     * @param ?string $password
-     * @param ?int    $encryptionMethod
-     *
      * @throws ZipEntryNotFoundException
      * @throws ZipEntryNotFoundException
      */
      */
     public function setPassword(?string $password, ?int $encryptionMethod = null): void
     public function setPassword(?string $password, ?int $encryptionMethod = null): void
     {
     {
         array_walk(
         array_walk(
             $this->matches,
             $this->matches,
-            /** @param string $entryName */
             function (string $entryName) use ($password, $encryptionMethod): void {
             function (string $entryName) use ($password, $encryptionMethod): void {
                 $entry = $this->zipContainer->getEntry($entryName);
                 $entry = $this->zipContainer->getEntry($entryName);
 
 
@@ -152,7 +140,6 @@ class ZipEntryMatcher implements \Countable
     {
     {
         array_walk(
         array_walk(
             $this->matches,
             $this->matches,
-            /** @param string $entryName */
             function (string $entryName) use ($encryptionMethod): void {
             function (string $entryName) use ($encryptionMethod): void {
                 $entry = $this->zipContainer->getEntry($entryName);
                 $entry = $this->zipContainer->getEntry($entryName);
 
 

+ 1 - 1
src/Util/MathUtil.php

@@ -19,7 +19,7 @@ namespace PhpZip\Util;
 final class MathUtil
 final class MathUtil
 {
 {
     /**
     /**
-     * Cast to signed int 32-bit.
+     * Cast to a signed 32-bit integer.
      */
      */
     public static function toSignedInt32(int $int): int
     public static function toSignedInt32(int $int): int
     {
     {

+ 29 - 116
src/ZipFile.php

@@ -92,8 +92,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * Open zip archive from file.
      * Open zip archive from file.
      *
      *
      * @throws ZipException if can't open file
      * @throws ZipException if can't open file
-     *
-     * @return ZipFile
      */
      */
     public function openFile(string $filename, array $options = []): self
     public function openFile(string $filename, array $options = []): self
     {
     {
@@ -117,8 +115,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * Open zip archive from raw string data.
      * Open zip archive from raw string data.
      *
      *
      * @throws ZipException if can't open temp stream
      * @throws ZipException if can't open temp stream
-     *
-     * @return ZipFile
      */
      */
     public function openFromString(string $data, array $options = []): self
     public function openFromString(string $data, array $options = []): self
     {
     {
@@ -143,8 +139,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * @param resource $handle
      * @param resource $handle
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function openFromStream($handle, array $options = []): self
     public function openFromStream($handle, array $options = []): self
     {
     {
@@ -183,10 +177,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
 
 
     /**
     /**
      * Set archive comment.
      * Set archive comment.
-     *
-     * @param ?string $comment
-     *
-     * @return ZipFile
      */
      */
     public function setArchiveComment(?string $comment = null): self
     public function setArchiveComment(?string $comment = null): self
     {
     {
@@ -239,12 +229,8 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     /**
     /**
      * Set entry comment.
      * Set entry comment.
      *
      *
-     * @param ?string $comment
-     *
      * @throws ZipEntryNotFoundException
      * @throws ZipEntryNotFoundException
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function setEntryComment(string $entryName, ?string $comment = null): self
     public function setEntryComment(string $entryName, ?string $comment = null): self
     {
     {
@@ -264,7 +250,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
         $zipData = $this->zipContainer->getEntry($entryName)->getData();
         $zipData = $this->zipContainer->getEntry($entryName)->getData();
 
 
         if ($zipData === null) {
         if ($zipData === null) {
-            throw new ZipException(sprintf('No data for zip entry %s', $entryName));
+            throw new ZipException(\sprintf('No data for zip entry %s', $entryName));
         }
         }
 
 
         return $zipData->getDataAsString();
         return $zipData->getDataAsString();
@@ -290,7 +276,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Returns an array of zip records (ex. for modify time).
+     * Returns an array of zip entries (e.g. for inspecting modification times).
      *
      *
      * @return ZipEntry[] array of raw zip entries
      * @return ZipEntry[] array of raw zip entries
      */
      */
@@ -312,8 +298,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *                                     information about the extracted entries
      *                                     information about the extracted entries
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function extractTo(
     public function extractTo(
         string $destDir,
         string $destDir,
@@ -322,15 +306,15 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
         ?array &$extractedEntries = []
         ?array &$extractedEntries = []
     ): self {
     ): self {
         if (!file_exists($destDir)) {
         if (!file_exists($destDir)) {
-            throw new ZipException(sprintf('Destination %s not found', $destDir));
+            throw new ZipException(\sprintf('Destination %s not found', $destDir));
         }
         }
 
 
         if (!is_dir($destDir)) {
         if (!is_dir($destDir)) {
-            throw new ZipException('Destination is not directory');
+            throw new ZipException('Destination is not a directory');
         }
         }
 
 
         if (!is_writable($destDir)) {
         if (!is_writable($destDir)) {
-            throw new ZipException('Destination is not writable directory');
+            throw new ZipException('Destination is not a writable directory');
         }
         }
 
 
         if ($extractedEntries === null) {
         if ($extractedEntries === null) {
@@ -389,7 +373,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
 
 
                 if (!mkdir($dir, $dirMode, true) && !is_dir($dir)) {
                 if (!mkdir($dir, $dirMode, true) && !is_dir($dir)) {
                     // @codeCoverageIgnoreStart
                     // @codeCoverageIgnoreStart
-                    throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir));
+                    throw new \RuntimeException(\sprintf('Directory "%s" was not created', $dir));
                     // @codeCoverageIgnoreEnd
                     // @codeCoverageIgnoreEnd
                 }
                 }
                 chmod($dir, $dirMode);
                 chmod($dir, $dirMode);
@@ -428,7 +412,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
             set_error_handler(
             set_error_handler(
                 static function (int $errorNumber, string $errorString) use ($entry, $file): ?bool {
                 static function (int $errorNumber, string $errorString) use ($entry, $file): ?bool {
                     throw new ZipException(
                     throw new ZipException(
-                        sprintf(
+                        \sprintf(
                             'Cannot extract zip entry %s. File %s cannot open for write. %s',
                             'Cannot extract zip entry %s. File %s cannot open for write. %s',
                             $entry->getName(),
                             $entry->getName(),
                             $file,
                             $file,
@@ -508,8 +492,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *                                    If null, then auto choosing method.
      *                                    If null, then auto choosing method.
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function addFromString(string $entryName, string $contents, ?int $compressionMethod = null): self
     public function addFromString(string $entryName, string $contents, ?int $compressionMethod = null): self
     {
     {
@@ -589,8 +571,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * @param ?string $entryName
-     *
      * @throws ZipException
      * @throws ZipException
      */
      */
     public function addSplFile(\SplFileInfo $file, ?string $entryName = null, array $options = []): ZipEntry
     public function addSplFile(\SplFileInfo $file, ?string $entryName = null, array $options = []): ZipEntry
@@ -606,7 +586,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
         $options += $defaultOptions;
         $options += $defaultOptions;
 
 
         if (!$file->isReadable()) {
         if (!$file->isReadable()) {
-            throw new InvalidArgumentException(sprintf('File %s is not readable', $file->getPathname()));
+            throw new InvalidArgumentException(\sprintf('File %s is not readable', $file->getPathname()));
         }
         }
 
 
         if ($entryName === null) {
         if ($entryName === null) {
@@ -708,8 +688,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *                                       If null, then auto choosing method.
      *                                       If null, then auto choosing method.
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function addFile(string $filename, ?string $entryName = null, ?int $compressionMethod = null): self
     public function addFile(string $filename, ?string $entryName = null, ?int $compressionMethod = null): self
     {
     {
@@ -736,13 +714,11 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *                                    If null, then auto choosing method.
      *                                    If null, then auto choosing method.
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function addFromStream($stream, string $entryName, ?int $compressionMethod = null): self
     public function addFromStream($stream, string $entryName, ?int $compressionMethod = null): self
     {
     {
         if (!\is_resource($stream)) {
         if (!\is_resource($stream)) {
-            throw new InvalidArgumentException('Stream is not resource');
+            throw new InvalidArgumentException('Stream is not a resource');
         }
         }
 
 
         $entryName = $this->normalizeEntryName($entryName);
         $entryName = $this->normalizeEntryName($entryName);
@@ -791,8 +767,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * Add an empty directory in the zip archive.
      * Add an empty directory in the zip archive.
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function addEmptyDir(string $dirName): self
     public function addEmptyDir(string $dirName): self
     {
     {
@@ -815,7 +789,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Add directory not recursively to the zip archive.
+     * Add a directory to the zip archive without recursion.
      *
      *
      * @param string   $inputDir          Input directory
      * @param string   $inputDir          Input directory
      * @param string   $localPath         add files to this directory, or the root
      * @param string   $localPath         add files to this directory, or the root
@@ -826,8 +800,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *                                    If null, then auto choosing method.
      *                                    If null, then auto choosing method.
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function addDir(string $inputDir, string $localPath = '/', ?int $compressionMethod = null): self
     public function addDir(string $inputDir, string $localPath = '/', ?int $compressionMethod = null): self
     {
     {
@@ -836,7 +808,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
         }
         }
 
 
         if (!is_dir($inputDir)) {
         if (!is_dir($inputDir)) {
-            throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
+            throw new InvalidArgumentException(\sprintf('The "%s" directory does not exist.', $inputDir));
         }
         }
         $inputDir = rtrim($inputDir, '/\\') . \DIRECTORY_SEPARATOR;
         $inputDir = rtrim($inputDir, '/\\') . \DIRECTORY_SEPARATOR;
 
 
@@ -846,7 +818,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Add recursive directory to the zip archive.
+     * Add a directory recursively to the zip archive.
      *
      *
      * @param string   $inputDir          Input directory
      * @param string   $inputDir          Input directory
      * @param string   $localPath         add files to this directory, or the root
      * @param string   $localPath         add files to this directory, or the root
@@ -858,8 +830,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *
      *
      * @throws ZipException
      * @throws ZipException
      *
      *
-     * @return ZipFile
-     *
      * @see ZipCompressionMethod::STORED
      * @see ZipCompressionMethod::STORED
      * @see ZipCompressionMethod::DEFLATED
      * @see ZipCompressionMethod::DEFLATED
      * @see ZipCompressionMethod::BZIP2
      * @see ZipCompressionMethod::BZIP2
@@ -871,7 +841,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
         }
         }
 
 
         if (!is_dir($inputDir)) {
         if (!is_dir($inputDir)) {
-            throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
+            throw new InvalidArgumentException(\sprintf('The "%s" directory does not exist.', $inputDir));
         }
         }
         $inputDir = rtrim($inputDir, '/\\') . \DIRECTORY_SEPARATOR;
         $inputDir = rtrim($inputDir, '/\\') . \DIRECTORY_SEPARATOR;
 
 
@@ -893,8 +863,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *
      *
      * @throws ZipException
      * @throws ZipException
      *
      *
-     * @return ZipFile
-     *
      * @see ZipCompressionMethod::STORED
      * @see ZipCompressionMethod::STORED
      * @see ZipCompressionMethod::DEFLATED
      * @see ZipCompressionMethod::DEFLATED
      * @see ZipCompressionMethod::BZIP2
      * @see ZipCompressionMethod::BZIP2
@@ -959,7 +927,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *
      *
      * @throws ZipException
      * @throws ZipException
      *
      *
-     * @return ZipFile
      * @sse https://en.wikipedia.org/wiki/Glob_(programming) Glob pattern syntax
      * @sse https://en.wikipedia.org/wiki/Glob_(programming) Glob pattern syntax
      */
      */
     public function addFilesFromGlob(
     public function addFilesFromGlob(
@@ -986,8 +953,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *
      *
      * @throws ZipException
      * @throws ZipException
      *
      *
-     * @return ZipFile
-     *
      * @sse https://en.wikipedia.org/wiki/Glob_(programming) Glob pattern syntax
      * @sse https://en.wikipedia.org/wiki/Glob_(programming) Glob pattern syntax
      */
      */
     private function addGlob(
     private function addGlob(
@@ -1002,7 +967,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
         }
         }
 
 
         if (!is_dir($inputDir)) {
         if (!is_dir($inputDir)) {
-            throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
+            throw new InvalidArgumentException(\sprintf('The "%s" directory does not exist.', $inputDir));
         }
         }
 
 
         if (empty($globPattern)) {
         if (empty($globPattern)) {
@@ -1037,7 +1002,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *
      *
      * @throws ZipException
      * @throws ZipException
      *
      *
-     * @return ZipFile
      * @sse https://en.wikipedia.org/wiki/Glob_(programming) Glob pattern syntax
      * @sse https://en.wikipedia.org/wiki/Glob_(programming) Glob pattern syntax
      */
      */
     public function addFilesFromGlobRecursive(
     public function addFilesFromGlobRecursive(
@@ -1063,8 +1027,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *
      *
      * @throws ZipException
      * @throws ZipException
      *
      *
-     * @return ZipFile
-     *
      * @internal param bool $recursive Recursive search
      * @internal param bool $recursive Recursive search
      */
      */
     public function addFilesFromRegex(
     public function addFilesFromRegex(
@@ -1090,8 +1052,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *                                    If null, then auto choosing method.
      *                                    If null, then auto choosing method.
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     private function addRegex(
     private function addRegex(
         string $inputDir,
         string $inputDir,
@@ -1109,7 +1069,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
         }
         }
 
 
         if (!is_dir($inputDir)) {
         if (!is_dir($inputDir)) {
-            throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
+            throw new InvalidArgumentException(\sprintf('The "%s" directory does not exist.', $inputDir));
         }
         }
         $inputDir = rtrim($inputDir, '/\\') . \DIRECTORY_SEPARATOR;
         $inputDir = rtrim($inputDir, '/\\') . \DIRECTORY_SEPARATOR;
 
 
@@ -1125,8 +1085,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * @param ?int $compressionMethod
-     *
      * @throws ZipException
      * @throws ZipException
      */
      */
     private function doAddFiles(
     private function doAddFiles(
@@ -1172,8 +1130,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *
      *
      * @throws ZipException
      * @throws ZipException
      *
      *
-     * @return ZipFile
-     *
      * @internal param bool $recursive Recursive search
      * @internal param bool $recursive Recursive search
      */
      */
     public function addFilesFromRegexRecursive(
     public function addFilesFromRegexRecursive(
@@ -1186,9 +1142,9 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Add array data to archive.
-     * Keys is local names.
-     * Values is contents.
+     * Add array data to the archive.
+     * Keys are local names.
+     * Values are contents.
      *
      *
      * @param array $mapData associative array for added to zip
      * @param array $mapData associative array for added to zip
      */
      */
@@ -1206,8 +1162,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * @param string $newName new entry name
      * @param string $newName new entry name
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function rename(string $oldName, string $newName): self
     public function rename(string $oldName, string $newName): self
     {
     {
@@ -1227,8 +1181,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * @param string $entryName zip Entry name
      * @param string $entryName zip Entry name
      *
      *
      * @throws ZipEntryNotFoundException if entry not found
      * @throws ZipEntryNotFoundException if entry not found
-     *
-     * @return ZipFile
      */
      */
     public function deleteFromName(string $entryName): self
     public function deleteFromName(string $entryName): self
     {
     {
@@ -1246,7 +1198,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *
      *
      * @param string $globPattern Glob pattern
      * @param string $globPattern Glob pattern
      *
      *
-     * @return ZipFile
      * @sse https://en.wikipedia.org/wiki/Glob_(programming) Glob pattern syntax
      * @sse https://en.wikipedia.org/wiki/Glob_(programming) Glob pattern syntax
      */
      */
     public function deleteFromGlob(string $globPattern): self
     public function deleteFromGlob(string $globPattern): self
@@ -1264,8 +1215,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * Delete entries by regex pattern.
      * Delete entries by regex pattern.
      *
      *
      * @param string $regexPattern Regex pattern
      * @param string $regexPattern Regex pattern
-     *
-     * @return ZipFile
      */
      */
     public function deleteFromRegex(string $regexPattern): self
     public function deleteFromRegex(string $regexPattern): self
     {
     {
@@ -1279,8 +1228,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
 
 
     /**
     /**
      * Delete all entries.
      * Delete all entries.
-     *
-     * @return ZipFile
      */
      */
     public function deleteAll(): self
     public function deleteAll(): self
     {
     {
@@ -1292,8 +1239,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     /**
     /**
      * Set compression level for new entries.
      * Set compression level for new entries.
      *
      *
-     * @return ZipFile
-     *
      * @see ZipCompressionLevel::NORMAL
      * @see ZipCompressionLevel::NORMAL
      * @see ZipCompressionLevel::SUPER_FAST
      * @see ZipCompressionLevel::SUPER_FAST
      * @see ZipCompressionLevel::FAST
      * @see ZipCompressionLevel::FAST
@@ -1311,8 +1256,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     /**
     /**
      * @throws ZipException
      * @throws ZipException
      *
      *
-     * @return ZipFile
-     *
      * @see ZipCompressionLevel::NORMAL
      * @see ZipCompressionLevel::NORMAL
      * @see ZipCompressionLevel::SUPER_FAST
      * @see ZipCompressionLevel::SUPER_FAST
      * @see ZipCompressionLevel::FAST
      * @see ZipCompressionLevel::FAST
@@ -1334,8 +1277,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      *
      *
      * @throws ZipException
      * @throws ZipException
      *
      *
-     * @return ZipFile
-     *
      * @see ZipCompressionMethod::STORED
      * @see ZipCompressionMethod::STORED
      * @see ZipCompressionMethod::DEFLATED
      * @see ZipCompressionMethod::DEFLATED
      * @see ZipCompressionMethod::BZIP2
      * @see ZipCompressionMethod::BZIP2
@@ -1351,11 +1292,9 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Set password to all input encrypted entries.
+     * Set the password for reading all encrypted entries.
      *
      *
      * @param string $password Password
      * @param string $password Password
-     *
-     * @return ZipFile
      */
      */
     public function setReadPassword(string $password): self
     public function setReadPassword(string $password): self
     {
     {
@@ -1365,13 +1304,11 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Set password to concrete input entry.
+     * Set the password for reading a specific entry.
      *
      *
      * @param string $password Password
      * @param string $password Password
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function setReadPasswordEntry(string $entryName, string $password): self
     public function setReadPasswordEntry(string $entryName, string $password): self
     {
     {
@@ -1387,8 +1324,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * @param int|null $encryptionMethod Encryption method
      * @param int|null $encryptionMethod Encryption method
      *
      *
      * @throws ZipEntryNotFoundException
      * @throws ZipEntryNotFoundException
-     *
-     * @return ZipFile
      */
      */
     public function setPassword(string $password, ?int $encryptionMethod = ZipEncryptionMethod::WINZIP_AES_256): self
     public function setPassword(string $password, ?int $encryptionMethod = ZipEncryptionMethod::WINZIP_AES_256): self
     {
     {
@@ -1402,13 +1337,9 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Sets a new password of an entry defined by its name.
-     *
-     * @param ?int $encryptionMethod
+     * Sets a new password for an entry identified by its name.
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function setPasswordEntry(string $entryName, string $password, ?int $encryptionMethod = null): self
     public function setPasswordEntry(string $entryName, string $password, ?int $encryptionMethod = null): self
     {
     {
@@ -1421,8 +1352,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * Disable encryption for all entries that are already in the archive.
      * Disable encryption for all entries that are already in the archive.
      *
      *
      * @throws ZipEntryNotFoundException
      * @throws ZipEntryNotFoundException
-     *
-     * @return ZipFile
      */
      */
     public function disableEncryption(): self
     public function disableEncryption(): self
     {
     {
@@ -1435,8 +1364,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * Disable encryption of an entry defined by its name.
      * Disable encryption of an entry defined by its name.
      *
      *
      * @throws ZipEntryNotFoundException
      * @throws ZipEntryNotFoundException
-     *
-     * @return ZipFile
      */
      */
     public function disableEncryptionEntry(string $entryName): self
     public function disableEncryptionEntry(string $entryName): self
     {
     {
@@ -1446,9 +1373,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Undo all changes done in the archive.
-     *
-     * @return ZipFile
+     * Undo all changes made to the archive.
      */
      */
     public function unchangeAll(): self
     public function unchangeAll(): self
     {
     {
@@ -1458,9 +1383,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Undo change archive comment.
-     *
-     * @return ZipFile
+     * Undo changes to the archive comment.
      */
      */
     public function unchangeArchiveComment(): self
     public function unchangeArchiveComment(): self
     {
     {
@@ -1470,11 +1393,9 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Revert all changes done to an entry with the given name.
+     * Revert all changes made to an entry with the given name.
      *
      *
      * @param string|ZipEntry $entry Entry name or ZipEntry
      * @param string|ZipEntry $entry Entry name or ZipEntry
-     *
-     * @return ZipFile
      */
      */
     public function unchangeEntry($entry): self
     public function unchangeEntry($entry): self
     {
     {
@@ -1489,8 +1410,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * @param string $filename Output filename
      * @param string $filename Output filename
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function saveAsFile(string $filename): self
     public function saveAsFile(string $filename): self
     {
     {
@@ -1527,7 +1446,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
                 unlink($tempFilename);
                 unlink($tempFilename);
             }
             }
 
 
-            throw new ZipException(sprintf('Cannot move %s to %s', $tempFilename, $filename));
+            throw new ZipException(\sprintf('Cannot move %s to %s', $tempFilename, $filename));
         }
         }
 
 
         if ($reopen) {
         if ($reopen) {
@@ -1543,13 +1462,11 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * @param resource $handle Output stream resource
      * @param resource $handle Output stream resource
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function saveAsStream($handle): self
     public function saveAsStream($handle): self
     {
     {
         if (!\is_resource($handle)) {
         if (!\is_resource($handle)) {
-            throw new InvalidArgumentException('handle is not resource');
+            throw new InvalidArgumentException('handle is not a resource');
         }
         }
 
 
         $this->writeZipToStream($handle);
         $this->writeZipToStream($handle);
@@ -1591,8 +1508,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * @param ?string $mimeType
-     *
      * @throws ZipException
      * @throws ZipException
      */
      */
     private function getOutputData(string $outputFilename, ?string $mimeType = null, bool $attachment = true): array
     private function getOutputData(string $outputFilename, ?string $mimeType = null, bool $attachment = true): array
@@ -1654,7 +1569,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
         bool $attachment = true
         bool $attachment = true
     ): ResponseInterface {
     ): ResponseInterface {
         @trigger_error(
         @trigger_error(
-            sprintf(
+            \sprintf(
                 'Method %s is deprecated. Replace to %s::%s',
                 'Method %s is deprecated. Replace to %s::%s',
                 __METHOD__,
                 __METHOD__,
                 __CLASS__,
                 __CLASS__,
@@ -1773,7 +1688,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Close zip archive and release input stream.
+     * Close the zip archive and release the input stream.
      */
      */
     public function close(): void
     public function close(): void
     {
     {
@@ -1789,8 +1704,6 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
      * Save and reopen zip archive.
      * Save and reopen zip archive.
      *
      *
      * @throws ZipException
      * @throws ZipException
-     *
-     * @return ZipFile
      */
      */
     public function rewrite(): self
     public function rewrite(): self
     {
     {
@@ -1932,7 +1845,7 @@ class ZipFile implements \Countable, \ArrayAccess, \Iterator
     }
     }
 
 
     /**
     /**
-     * Whether a offset exists.
+     * Whether an offset exists.
      *
      *
      * @see http://php.net/manual/en/arrayaccess.offsetexists.php
      * @see http://php.net/manual/en/arrayaccess.offsetexists.php
      *
      *

+ 1 - 1
tests/Extra/Fields/AsiExtraFieldTest.php

@@ -92,7 +92,7 @@ final class AsiExtraFieldTest extends TestCase
     public function testInvalidParse(): void
     public function testInvalidParse(): void
     {
     {
         $this->expectException(Crc32Exception::class);
         $this->expectException(Crc32Exception::class);
-        $this->expectExceptionMessage('Asi Unix Extra Filed Data (expected CRC32 value');
+        $this->expectExceptionMessage('Asi Unix Extra Field Data (expected CRC32 value');
 
 
         AsiExtraField::unpackLocalFileData("\x01\x06\\\xF6\xEDA\x00\x00\x00\x00\xE8\x03\xE8\x03");
         AsiExtraField::unpackLocalFileData("\x01\x06\\\xF6\xEDA\x00\x00\x00\x00\xE8\x03\xE8\x03");
     }
     }

+ 2 - 2
tests/Extra/Fields/UnrecognizedExtraFieldTest.php

@@ -47,7 +47,7 @@ final class UnrecognizedExtraFieldTest extends TestCase
     public function testUnpackLocalData(): void
     public function testUnpackLocalData(): void
     {
     {
         $this->expectException(RuntimeException::class);
         $this->expectException(RuntimeException::class);
-        $this->expectExceptionMessage('Unsupport parse');
+        $this->expectExceptionMessage('Parsing is not supported for unrecognized extra fields.');
 
 
         UnrecognizedExtraField::unpackLocalFileData("\x01\x02");
         UnrecognizedExtraField::unpackLocalFileData("\x01\x02");
     }
     }
@@ -55,7 +55,7 @@ final class UnrecognizedExtraFieldTest extends TestCase
     public function testUnpackCentralDirData(): void
     public function testUnpackCentralDirData(): void
     {
     {
         $this->expectException(RuntimeException::class);
         $this->expectException(RuntimeException::class);
-        $this->expectExceptionMessage('Unsupport parse');
+        $this->expectExceptionMessage('Parsing is not supported for unrecognized extra fields.');
 
 
         UnrecognizedExtraField::unpackCentralDirData("\x01\x02");
         UnrecognizedExtraField::unpackCentralDirData("\x01\x02");
     }
     }

+ 4 - 4
tests/Extra/Fields/WinZipAesExtraFieldTest.php

@@ -158,7 +158,7 @@ final class WinZipAesExtraFieldTest extends TestCase
     public function testConstructUnsupportVendorVersion(): void
     public function testConstructUnsupportVendorVersion(): void
     {
     {
         $this->expectException(InvalidArgumentException::class);
         $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage('Unsupport WinZip AES vendor version: 3');
+        $this->expectExceptionMessage('Unsupported WinZip AES vendor version: 3');
 
 
         new WinZipAesExtraField(
         new WinZipAesExtraField(
             3,
             3,
@@ -170,7 +170,7 @@ final class WinZipAesExtraFieldTest extends TestCase
     public function testSetterUnsupportVendorVersion(): void
     public function testSetterUnsupportVendorVersion(): void
     {
     {
         $this->expectException(InvalidArgumentException::class);
         $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage('Unsupport WinZip AES vendor version: 3');
+        $this->expectExceptionMessage('Unsupported WinZip AES vendor version: 3');
 
 
         $extraField = new WinZipAesExtraField(
         $extraField = new WinZipAesExtraField(
             WinZipAesExtraField::VERSION_AE1,
             WinZipAesExtraField::VERSION_AE1,
@@ -211,7 +211,7 @@ final class WinZipAesExtraFieldTest extends TestCase
     public function testConstructUnsupportKeyStrength(): void
     public function testConstructUnsupportKeyStrength(): void
     {
     {
         $this->expectException(InvalidArgumentException::class);
         $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage('Key strength 16 not support value. Allow values: 1, 2, 3');
+        $this->expectExceptionMessage('Invalid key strength 16. Allowed values: 1, 2, 3');
 
 
         new WinZipAesExtraField(
         new WinZipAesExtraField(
             WinZipAesExtraField::VERSION_AE1,
             WinZipAesExtraField::VERSION_AE1,
@@ -226,7 +226,7 @@ final class WinZipAesExtraFieldTest extends TestCase
     public function testSetterUnsupportKeyStrength(): void
     public function testSetterUnsupportKeyStrength(): void
     {
     {
         $this->expectException(InvalidArgumentException::class);
         $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage('Key strength 16 not support value. Allow values: 1, 2, 3');
+        $this->expectExceptionMessage('Invalid key strength 16. Allowed values: 1, 2, 3');
 
 
         new WinZipAesExtraField(
         new WinZipAesExtraField(
             WinZipAesExtraField::VERSION_AE1,
             WinZipAesExtraField::VERSION_AE1,

+ 2 - 2
tests/Internal/DummyFileSystemStream.php

@@ -12,7 +12,7 @@ declare(strict_types=1);
 namespace PhpZip\Tests\Internal;
 namespace PhpZip\Tests\Internal;
 
 
 /**
 /**
- * Try to load using dummy stream.
+ * A dummy stream wrapper for testing.
  *
  *
  * @see https://www.php.net/streamwrapper
  * @see https://www.php.net/streamwrapper
  */
  */
@@ -24,7 +24,7 @@ class DummyFileSystemStream
      *
      *
      * @var resource|null
      * @var resource|null
      */
      */
-    public $context = null;
+    public $context;
 
 
     /** @var resource */
     /** @var resource */
     private $fp;
     private $fp;

+ 7 - 8
tests/ZipFileTest.php

@@ -166,7 +166,7 @@ class ZipFileTest extends ZipTestCase
     public function testOpenFromStreamInvalidResourceType3(): void
     public function testOpenFromStreamInvalidResourceType3(): void
     {
     {
         $this->expectException(InvalidArgumentException::class);
         $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage('Directory stream not supported');
+        $this->expectExceptionMessage('Directory streams are not supported');
 
 
         $zipFile = new ZipFile();
         $zipFile = new ZipFile();
         $zipFile->openFromStream(opendir(__DIR__));
         $zipFile->openFromStream(opendir(__DIR__));
@@ -174,6 +174,7 @@ class ZipFileTest extends ZipTestCase
 
 
     /**
     /**
      * @throws ZipException
      * @throws ZipException
+     *
      * @noinspection PhpUsageOfSilenceOperatorInspection
      * @noinspection PhpUsageOfSilenceOperatorInspection
      * @noinspection NestedPositiveIfStatementsInspection
      * @noinspection NestedPositiveIfStatementsInspection
      */
      */
@@ -481,7 +482,7 @@ class ZipFileTest extends ZipTestCase
     public function testRenameEntryToExistsNewEntry(): void
     public function testRenameEntryToExistsNewEntry(): void
     {
     {
         $this->expectException(InvalidArgumentException::class);
         $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage('is exists');
+        $this->expectExceptionMessage('already exists');
 
 
         $zipFile = new ZipFile();
         $zipFile = new ZipFile();
         $zipFile['file'] = 'content';
         $zipFile['file'] = 'content';
@@ -1076,7 +1077,7 @@ class ZipFileTest extends ZipTestCase
     public function testExtractFail2(): void
     public function testExtractFail2(): void
     {
     {
         $this->expectException(ZipException::class);
         $this->expectException(ZipException::class);
-        $this->expectExceptionMessage('Destination is not directory');
+        $this->expectExceptionMessage('Destination is not a directory');
 
 
         $zipFile = new ZipFile();
         $zipFile = new ZipFile();
         $zipFile['file'] = 'content';
         $zipFile['file'] = 'content';
@@ -1093,7 +1094,7 @@ class ZipFileTest extends ZipTestCase
     public function testExtractFail3(): void
     public function testExtractFail3(): void
     {
     {
         $this->expectException(ZipException::class);
         $this->expectException(ZipException::class);
-        $this->expectExceptionMessage('Destination is not writable directory');
+        $this->expectExceptionMessage('Destination is not a writable directory');
 
 
         static::skipTestForRootUser();
         static::skipTestForRootUser();
 
 
@@ -1194,7 +1195,7 @@ class ZipFileTest extends ZipTestCase
     public function testAddFromStreamInvalidResource(): void
     public function testAddFromStreamInvalidResource(): void
     {
     {
         $this->expectException(InvalidArgumentException::class);
         $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage('Stream is not resource');
+        $this->expectExceptionMessage('Stream is not a resource');
 
 
         $zipFile = new ZipFile();
         $zipFile = new ZipFile();
         /** @noinspection PhpParamsInspection */
         /** @noinspection PhpParamsInspection */
@@ -1504,7 +1505,7 @@ class ZipFileTest extends ZipTestCase
     public function testSaveAsStreamBadStream(): void
     public function testSaveAsStreamBadStream(): void
     {
     {
         $this->expectException(InvalidArgumentException::class);
         $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage('handle is not resource');
+        $this->expectExceptionMessage('handle is not a resource');
 
 
         $zipFile = new ZipFile();
         $zipFile = new ZipFile();
         /** @noinspection PhpParamsInspection */
         /** @noinspection PhpParamsInspection */
@@ -2145,8 +2146,6 @@ class ZipFileTest extends ZipTestCase
      *
      *
      * @dataProvider provideOutputAsAttachment
      * @dataProvider provideOutputAsAttachment
      *
      *
-     * @param ?string $mimeType
-     *
      * @throws ZipException
      * @throws ZipException
      */
      */
     public function testOutputAsAttachment(string $zipFilename, ?string $mimeType, string $expectedMimeType, bool $attachment, string $expectedAttachment): void
     public function testOutputAsAttachment(string $zipFilename, ?string $mimeType, string $expectedMimeType, bool $attachment, string $expectedAttachment): void

+ 1 - 3
tests/ZipStreamOpenTest.php

@@ -29,8 +29,6 @@ class ZipStreamOpenTest extends TestCase
      * @dataProvider provideStreams
      * @dataProvider provideStreams
      *
      *
      * @param resource $resource
      * @param resource $resource
-     * @param ?string  $exceptionClass
-     * @param ?string  $exceptionMessage
      *
      *
      * @throws ZipException
      * @throws ZipException
      */
      */
@@ -60,7 +58,7 @@ class ZipStreamOpenTest extends TestCase
             [
             [
                 @fopen(__DIR__, 'rb'),
                 @fopen(__DIR__, 'rb'),
                 InvalidArgumentException::class,
                 InvalidArgumentException::class,
-                'Directory stream not supported',
+                'Directory streams are not supported',
             ],
             ],
             [$this->getTempResource('php://temp'), null, null],
             [$this->getTempResource('php://temp'), null, null],
             [$this->getTempResource('php://memory'), null, null],
             [$this->getTempResource('php://memory'), null, null],