Skip to content

Commit

Permalink
CI Fixes (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
maennchen authored Jan 22, 2024
1 parent 52db867 commit 3e39b0e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"test:formatted": "@format --dry-run --stop-on-violation --using-cache=no",
"test:lint": "psalm --stats --show-info=true --find-unused-psalm-suppress",
"coverage:report": "php-coveralls --coverage_clover=coverage.clover.xml --json_path=coveralls-upload.json --insecure",
"install:tools": "phive install --trust-gpg-keys 0x67F861C3D889C656",
"install:tools": "phive install --trust-gpg-keys 0x67F861C3D889C656 --trust-gpg-keys 0x8AC0BAA79732DD42",
"docs:generate": "tools/phpdocumentor --sourcecode"
},
"autoload": {
Expand Down
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 3e39b0e

Please sign in to comment.