Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#318 fix code style
  • Loading branch information
Valentin V / vvval committed May 5, 2020
commit 12e2dcacacbd6e60a1a18774b65eb3462795e1c7
2 changes: 1 addition & 1 deletion src/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function getWorker(): Worker
* @return mixed[]|null Request information as ['ctx'=>[], 'body'=>string]
* or null if termination request or invalid context.
*/
public function acceptRequest()
public function acceptRequest(): ?array
{
$body = $this->getWorker()->receive($ctx);
if (empty($body) && empty($ctx)) {
Expand Down
14 changes: 7 additions & 7 deletions src/PSR7Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
namespace Spiral\RoadRunner;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UploadedFileInterface;
use Psr\Http\Message\ServerRequestFactoryInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UploadedFileFactoryInterface;
use Psr\Http\Message\UploadedFileInterface;

/**
* Manages PSR-7 request and response.
Expand Down Expand Up @@ -69,7 +69,7 @@ public function getWorker(): Worker
/**
* @return ServerRequestInterface|null
*/
public function acceptRequest()
public function acceptRequest(): ?ServerRequestInterface
{
$rawRequest = $this->httpClient->acceptRequest();
if ($rawRequest === null) {
Expand Down Expand Up @@ -101,11 +101,11 @@ public function acceptRequest()
}

if ($rawRequest['ctx']['parsed']) {
$request = $request->withParsedBody(json_decode($rawRequest['body'], true));
} else {
if ($rawRequest['body'] !== null) {
$request = $request->withBody($this->streamFactory->createStream($rawRequest['body']));
}
return $request->withParsedBody(json_decode($rawRequest['body'], true));
}

if ($rawRequest['body'] !== null) {
return $request->withBody($this->streamFactory->createStream($rawRequest['body']));
}

return $request;
Expand Down