Skip to content

Commit 5456f35

Browse files
committed
fix notices in tests
1 parent 7ad1a50 commit 5456f35

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

phpunit.xml

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
beStrictAboutOutputDuringTests="true"
1111
displayDetailsOnPhpunitDeprecations="true"
1212
failOnPhpunitDeprecation="true"
13+
displayDetailsOnTestsThatTriggerNotices="true"
14+
displayDetailsOnTestsThatTriggerDeprecations="true"
1315
failOnRisky="true"
1416
failOnWarning="true">
1517
<testsuites>

src/Psr7/Stream/Stream.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function write(string $string): int
172172
if (!$this->isWritable()) {
173173
throw new RuntimeException("Stream is not writable");
174174
}
175-
$result = fwrite($this->resource, $string);
175+
$result = @fwrite($this->resource, $string);
176176
if ($result === false) {
177177
throw new RuntimeException("Failed to write to stream");
178178
}
@@ -198,7 +198,7 @@ public function read(int $length): string
198198
if ($length <= 0) {
199199
return "";
200200
}
201-
$result = fread($this->resource, $length);
201+
$result = @fread($this->resource, $length);
202202
if ($result === false) {
203203
throw new RuntimeException("Failed to read from stream");
204204
}

src/Psr7/Uri.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected function setUserInfo(string $user, ?string $password): void
139139
}
140140

141141
$this->user = $this->encode($user, $pattern);
142-
if ($password === null && strlen($password) === 0) {
142+
if ($password === null || strlen($password) === 0) {
143143
$this->password = null;
144144
return;
145145
}
@@ -330,7 +330,7 @@ public function withUserInfo(string $user, ?string $password = null): UriInterfa
330330
return $this;
331331
}
332332

333-
if (strlen($password) === 0) {
333+
if ($password === null || strlen($password) === 0) {
334334
$password = null;
335335
}
336336

0 commit comments

Comments
 (0)