Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed wrong method names in the DocBlocks #297

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/ZipStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*
* // read and add each file to the archive
* foreach ($files as $path)
* $zip->addFileFormPath(fileName: $path, $path);
* $zip->addFileFromPath(fileName: $path, $path);
*
* // write archive footer to stream
* $zip->finish();
Expand Down Expand Up @@ -293,7 +293,7 @@
* // add a file named 'bigfile.rar' from the local file
* // '/usr/share/bigfile.rar' with a comment and a last-modified
* // time of two hours ago
* $zip->addFile(
* $zip->addFileFromPath(
* fileName: 'bigfile.rar',
* path: '/usr/share/bigfile.rar',
* comment: 'this is a comment about bigfile.rar',
Expand Down Expand Up @@ -330,7 +330,7 @@
throw new FileNotReadableException($path);
}

if ($fileTime = filemtime($path)) {

Check failure on line 333 in src/ZipStream.php

View workflow job for this annotation

GitHub Actions / Test / Run Psalm

RiskyTruthyFalsyComparison

src/ZipStream.php:333:13: RiskyTruthyFalsyComparison: Operand of type false|int contains type int, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead. (see https://psalm.dev/356)
$lastModificationDateTime ??= (new DateTimeImmutable())->setTimestamp($fileTime);
}

Expand Down Expand Up @@ -494,7 +494,7 @@
*
* ```php
* foreach($files as $name => $size) {
* $archive->addFileFromPsr7Stream(
* $archive->addFileFromCallback(
* fileName: 'streamfile.txt',
* exactSize: $size,
* callback: function() use($name): Psr\Http\Message\StreamInterface {
Expand Down Expand Up @@ -629,7 +629,7 @@
*
* ```php
* // add a directory named 'world/'
* $zip->addFile(fileName: 'world/');
* $zip->addDirectory(fileName: 'world/');
* ```
*/
public function addDirectory(
Expand Down Expand Up @@ -823,7 +823,7 @@
// grab content disposition
$disposition = $this->contentDisposition;

if ($this->outputName) {

Check failure on line 826 in src/ZipStream.php

View workflow job for this annotation

GitHub Actions / Test / Run Psalm

RiskyTruthyFalsyComparison

src/ZipStream.php:826:13: RiskyTruthyFalsyComparison: Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead. (see https://psalm.dev/356)
// Various different browsers dislike various characters here. Strip them all for safety.
$safeOutput = trim(str_replace(['"', "'", '\\', ';', "\n", "\r"], '', $this->outputName));

Expand Down
Loading