Skip to content

Commit

Permalink
CI Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maennchen committed Jan 22, 2024
1 parent 52db867 commit a6e1ffa
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function process(): string

if ($this->enableZeroHeader) {
// No calculation required
} elseif ($this->isSimulation() && $forecastSize) {
} elseif ($this->isSimulation() && $forecastSize !== null) {
$this->uncompressedSize = $forecastSize;
$this->compressedSize = $forecastSize;
} else {
Expand Down Expand Up @@ -158,7 +158,7 @@ private function forecastSize(): ?int
if ($this->compressionMethod !== CompressionMethod::STORE) {
return null;
}
if ($this->exactSize) {
if ($this->exactSize !== null) {
return $this->exactSize;
}
$fstat = fstat($this->unpackStream());
Expand Down Expand Up @@ -350,7 +350,7 @@ private function readStream(bool $send): void
}
}

if ($this->exactSize && $this->uncompressedSize !== $this->exactSize) {
if ($this->exactSize !== null && $this->uncompressedSize !== $this->exactSize) {
throw new FileSizeIncorrectException(expectedSize: $this->exactSize, actualSize: $this->uncompressedSize);
}

Expand Down
7 changes: 4 additions & 3 deletions src/ZipStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ public function addFileFromPath(
throw new FileNotReadableException($path);
}

if ($fileTime = filemtime($path)) {
$fileTime = filemtime($path);
if ($fileTime !== false) {
$lastModificationDateTime ??= (new DateTimeImmutable())->setTimestamp($fileTime);
}

Expand Down Expand Up @@ -581,7 +582,7 @@ public function addFileFromCallback(
if ($maxSize !== null && fwrite($stream, $data, $maxSize) === false) {
// @codeCoverageIgnoreStart
throw new ResourceActionException('fwrite', $stream);
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreEnd
} elseif (fwrite($stream, $data) === false) {
// @codeCoverageIgnoreStart
throw new ResourceActionException('fwrite', $stream);
Expand Down Expand Up @@ -823,7 +824,7 @@ private function sendHttpHeaders(): void
// grab content disposition
$disposition = $this->contentDisposition;

if ($this->outputName) {
if ($this->outputName !== null) {
// Various different browsers dislike various characters here. Strip them all for safety.
$safeOutput = trim(str_replace(['"', "'", '\\', ';', "\n", "\r"], '', $this->outputName));

Expand Down
2 changes: 1 addition & 1 deletion test/ResourceStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function seek(int $offset, int $whence = SEEK_SET): void

public function isSeekable(): bool
{
return (bool)$this->getMetadata('seekable');
return (bool) $this->getMetadata('seekable');
}

public function getMetadata(?string $key = null)
Expand Down
2 changes: 1 addition & 1 deletion test/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function getTmpDir(): string
protected function getRecursiveFileList(string $path, bool $includeDirectories = false): array
{
$data = [];
$path = (string)realpath($path);
$path = (string) realpath($path);
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));

$pathLen = strlen($path);
Expand Down
2 changes: 1 addition & 1 deletion test/ZipStreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ private function addLargeFileFileFromPath(CompressionMethod $compressionMethod,

[$tmpExample, $streamExample] = $this->getTmpFileStream();
for ($i = 0; $i <= 10000; $i++) {
fwrite($streamExample, sha1((string)$i));
fwrite($streamExample, sha1((string) $i));
if ($i % 100 === 0) {
fwrite($streamExample, "\n");
}
Expand Down

0 comments on commit a6e1ffa

Please sign in to comment.