Skip to content

Commit e74ac30

Browse files
authored
Use ResponseSequence::isEmpty() (#45757)
The class offers a `isEmpty()` method to check if the client has no responses anymore. Use that method to keep the implementation details in one place.
1 parent 209a4fc commit e74ac30

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Client/ResponseSequence.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ public function isEmpty()
143143
*/
144144
public function __invoke()
145145
{
146-
if ($this->failWhenEmpty && count($this->responses) === 0) {
146+
if ($this->failWhenEmpty && $this->isEmpty()) {
147147
throw new OutOfBoundsException('A request was made, but the response sequence is empty.');
148148
}
149149

150-
if (! $this->failWhenEmpty && count($this->responses) === 0) {
150+
if (! $this->failWhenEmpty && $this->isEmpty()) {
151151
return value($this->emptyResponse ?? Factory::response());
152152
}
153153

0 commit comments

Comments
 (0)