Skip to content

Commit

Permalink
Moving suppressions for unused return values to individual methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Aug 7, 2023
1 parent 8a7475c commit c51a436
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/TestAsset/MockStreamHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
use const SEEK_SET;

/**
* @psalm-suppress PossiblyUnusedMethod,PossiblyUnusedParam,PossiblyUnusedReturnValue
* @psalm-suppress PossiblyUnusedMethod
* @psalm-suppress PossiblyUnusedParam
*/
class MockStreamHelper
{
Expand All @@ -35,22 +36,26 @@ public function __construct(
$this->trackPeakBufferLength = $trackPeakBufferLength;
}

/** @psalm-suppress PossiblyUnusedReturnValue */
public function handleToString(): string
{
$this->position = $this->size;
return is_callable($this->contents) ? ($this->contents)(0) : $this->contents;
}

/** @psalm-suppress PossiblyUnusedReturnValue */
public function handleTell(): int
{
return $this->position;
}

/** @psalm-suppress PossiblyUnusedReturnValue */
public function handleEof(): bool
{
return $this->position >= $this->size;
}

/** @psalm-suppress PossiblyUnusedReturnValue */
public function handleSeek(int $offset, ?int $whence = SEEK_SET): bool
{
if ($offset >= $this->size) {
Expand All @@ -61,12 +66,14 @@ public function handleSeek(int $offset, ?int $whence = SEEK_SET): bool
return true;
}

/** @psalm-suppress PossiblyUnusedReturnValue */
public function handleRewind(): bool
{
$this->position = 0;
return true;
}

/** @psalm-suppress PossiblyUnusedReturnValue */
public function handleRead(int $length): string
{
if ($this->trackPeakBufferLength) {
Expand All @@ -82,6 +89,7 @@ public function handleRead(int $length): string
return $data;
}

/** @psalm-suppress PossiblyUnusedReturnValue */
public function handleGetContents(): string
{
$remainingContents = is_callable($this->contents)
Expand Down

0 comments on commit c51a436

Please sign in to comment.