diff --git a/src/Message/AbstractRequest.php b/src/Message/AbstractRequest.php index bbdbe92..82e1381 100644 --- a/src/Message/AbstractRequest.php +++ b/src/Message/AbstractRequest.php @@ -359,13 +359,14 @@ function ($event) { ->setHeader('Content-Type', 'application/xml') ->setHeader('bluesnap-version', self::API_VERSION); + // Fire a request event before sending request. + $eventDispatcher->dispatch( + PaymentGatewayLoggerConstants::OMNIPAY_REQUEST_BEFORE_SEND, + new RequestEvent($this) + ); + $httpResponse = null; try { - // Fire a request event before sending request. - $eventDispatcher->dispatch( - PaymentGatewayLoggerConstants::OMNIPAY_REQUEST_BEFORE_SEND, - new RequestEvent($this) - ); $httpResponse = $httpRequest->send(); } catch (Exception $e) { diff --git a/src/Message/HostedCheckoutDecryptReturnUrlRequest.php b/src/Message/HostedCheckoutDecryptReturnUrlRequest.php index ba7f29c..2cc1649 100644 --- a/src/Message/HostedCheckoutDecryptReturnUrlRequest.php +++ b/src/Message/HostedCheckoutDecryptReturnUrlRequest.php @@ -55,7 +55,7 @@ class HostedCheckoutDecryptReturnUrlRequest extends ExtendedAbstractRequest { /** * @return SimpleXMLElement - * @psalm-suppress PossiblyInvalidArrayAccess + * @psalm-suppress PossiblyInvalidArrayAccess because the existence of the key is checked first before using it. */ public function getData() { diff --git a/src/Message/IPNCallback.php b/src/Message/IPNCallback.php index 8213331..5e24536 100644 --- a/src/Message/IPNCallback.php +++ b/src/Message/IPNCallback.php @@ -76,7 +76,7 @@ class IPNCallback * $ipn can be a full URL, just the query string, or the value of the $_POST variable. * * @param string|array $ipn - * @psalm-suppress PossiblyInvalidArrayAccess + * @psalm-suppress PossiblyInvalidArrayAccess because the existence of the key is checked first before using it. */ public function __construct($ipn) { diff --git a/src/Message/Response.php b/src/Message/Response.php index 453cf73..4c21806 100644 --- a/src/Message/Response.php +++ b/src/Message/Response.php @@ -99,7 +99,7 @@ public function setCode($code) * Get the error message from the response. Returns null if request was successful. * * @return string|null - * @psalm-suppress MixedPropertyFetch + * @psalm-suppress MixedPropertyFetch because we check the data typing before using. */ public function getMessage() { diff --git a/tests/EventEmitterTest.php b/tests/EventEmitterTest.php index 267de17..6fa38c0 100644 --- a/tests/EventEmitterTest.php +++ b/tests/EventEmitterTest.php @@ -42,7 +42,6 @@ protected function setUp() /** * Ensures that 'Request' and 'Response' events are emitted when issuing a request. * - * @psalm-suppress UndefinedMethod * @return void */ public function testAuthorizeRequestSuccessfulResponseEmitted() @@ -96,7 +95,7 @@ function (ResponseEvent $event) use ($class) { /** * Ensures that 'Request' and 'Error' events are emitted when issuing an improper request. * - * @psalm-suppress UndefinedMethod + * @psalm-suppress UndefinedMethod because Psalm can't infer that it exists in the Mock object but it does! * @return void */ public function testAuthorizeRequestErrorEventEmitted()