diff --git a/src/WebPush.php b/src/WebPush.php index f1121bc..67eea42 100644 --- a/src/WebPush.php +++ b/src/WebPush.php @@ -182,7 +182,12 @@ public function flush(?int $batchSize = null): \Generator }) ->otherwise(function ($reason) { /** @var RequestException $reason **/ - return new MessageSentReport($reason->getRequest(), $reason->getResponse(), false, $reason->getMessage()); + if (method_exists($reason, 'getResponse')) { + $response = $reason->getResponse(); + } else { + $response = null; + } + return new MessageSentReport($reason->getRequest(), $response, false, $reason->getMessage()); }); }