Skip to content

Commit c1f637c

Browse files
authored
Merge pull request #111 from php-http/early-return
cleanup code with early return
2 parents f7159b6 + 06dd957 commit c1f637c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Formatter/FullHttpMessageFormatter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ private function addBody(MessageInterface $request, $message)
8080
$stream = $request->getBody();
8181
if (!$stream->isSeekable() || 0 === $this->maxBodyLength) {
8282
// Do not read the stream
83-
$message .= "\n";
84-
} else {
85-
$message .= "\n".mb_substr($stream->__toString(), 0, $this->maxBodyLength);
86-
$stream->rewind();
83+
return $message."\n";
8784
}
8885

86+
$message .= "\n".mb_substr($stream->__toString(), 0, $this->maxBodyLength);
87+
$stream->rewind();
88+
8989
return $message;
9090
}
9191
}

0 commit comments

Comments
 (0)