Skip to content

Commit

Permalink
fix notices in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtThiemann committed Nov 19, 2024
1 parent 7ad1a50 commit 5456f35
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
beStrictAboutOutputDuringTests="true"
displayDetailsOnPhpunitDeprecations="true"
failOnPhpunitDeprecation="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
failOnRisky="true"
failOnWarning="true">
<testsuites>
Expand Down
4 changes: 2 additions & 2 deletions src/Psr7/Stream/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function write(string $string): int
if (!$this->isWritable()) {
throw new RuntimeException("Stream is not writable");
}
$result = fwrite($this->resource, $string);
$result = @fwrite($this->resource, $string);
if ($result === false) {
throw new RuntimeException("Failed to write to stream");
}
Expand All @@ -198,7 +198,7 @@ public function read(int $length): string
if ($length <= 0) {
return "";
}
$result = fread($this->resource, $length);
$result = @fread($this->resource, $length);
if ($result === false) {
throw new RuntimeException("Failed to read from stream");
}
Expand Down
4 changes: 2 additions & 2 deletions src/Psr7/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected function setUserInfo(string $user, ?string $password): void
}

$this->user = $this->encode($user, $pattern);
if ($password === null && strlen($password) === 0) {
if ($password === null || strlen($password) === 0) {
$this->password = null;
return;
}
Expand Down Expand Up @@ -330,7 +330,7 @@ public function withUserInfo(string $user, ?string $password = null): UriInterfa
return $this;
}

if (strlen($password) === 0) {
if ($password === null || strlen($password) === 0) {
$password = null;
}

Expand Down

0 comments on commit 5456f35

Please sign in to comment.