diff --git a/Http/Statement.php b/Http/Statement.php index c6b067f..17a76ab 100644 --- a/Http/Statement.php +++ b/Http/Statement.php @@ -1,4 +1,5 @@ httpKernel = $httpKernel; } - + /** * * @param Request $request An http request object to send @@ -134,6 +137,12 @@ public function __construct(Request $request, EventDispatcherInterface $eventDis $this->promise = $this->deferred->promise(); $this->eventDispatcher = $eventDispatcher; $this->httpKernel = $httpKernel; + + if (function_exists('\React\Promise\set_rejection_handler')) { + \React\Promise\set_rejection_handler(fn(Throwable $e) => $this->logger?->warning( + 'Unhandled promise rejection with ' . $e->getMessage(), + )); + } } @@ -259,7 +268,6 @@ public function json($json = null) $json = (string) $json; } else { $json = json_encode(null); - } $this->request->setContent($json); } @@ -374,7 +382,8 @@ public function attachFile($key, $filepath, $mimetype = null, $clientName = null $file->getRealPath(), $clientName, $file->getMimeType(), - 0); + 0 + ); $this->getRequest()->files->set($key, $file); } @@ -447,9 +456,9 @@ public function authorizeOAuth($consumerKey, $consumerSecret) } /** - * @param string $key The key - * @param string|array $values The value or an array of values - * @param bool $replace Whether to replace the actual value or not (true by default) + * @param string $key The key + * @param string|array $values The value or an array of values + * @param bool $replace Whether to replace the actual value or not (true by default) * * @return self */ @@ -458,5 +467,4 @@ public function setHeader($key, $values, $replace = true) $this->request->headers->set($key, $values, $replace); return $this; } - -} \ No newline at end of file +}