From af57cafc0b65c32b19f57ede4aa89f6419d3a3a7 Mon Sep 17 00:00:00 2001 From: Nicky Robinson Date: Wed, 2 Nov 2016 15:03:08 -0400 Subject: [PATCH] Specify more precise return types to help Psalm --- src/Message/AbstractRequest.php | 16 ++++++++++++++++ src/Message/CaptureRequest.php | 12 ++++++++++++ src/Message/CompleteHOARequest.php | 12 ++++++++++++ src/Message/CreatePayPalSubscriptionRequest.php | 12 ++++++++++++ src/Message/PayPalPurchaseRequest.php | 12 ++++++++++++ src/Message/RefundRequest.php | 13 ++++++++++++- 6 files changed, 76 insertions(+), 1 deletion(-) diff --git a/src/Message/AbstractRequest.php b/src/Message/AbstractRequest.php index 4d1da0f..7a5f1c5 100644 --- a/src/Message/AbstractRequest.php +++ b/src/Message/AbstractRequest.php @@ -541,6 +541,10 @@ final protected function getEndpoint() . '.wsdl'; } + /** + * @param array + * @return Response + */ public function sendData($data) { $originalWsdlCacheEnabled = ini_get('soap.wsdl_cache_enabled'); @@ -595,6 +599,18 @@ public function sendData($data) return $this->response; } + /** + * Overriding to provide a more precise return type + * @return Response + */ + public function send() + { + /** + * @var Response + */ + return parent::send(); + } + protected function buildResponse($response) { return new Response($this, $response); diff --git a/src/Message/CaptureRequest.php b/src/Message/CaptureRequest.php index 8dc0f1c..c1edcba 100644 --- a/src/Message/CaptureRequest.php +++ b/src/Message/CaptureRequest.php @@ -134,6 +134,18 @@ public function getData() return $data; } + /** + * Overriding to provide a more precise return type + * @return CaptureResponse + */ + public function send() + { + /** + * @var CaptureResponse + */ + return parent::send(); + } + /** * Use a special response object for Capture requests. * diff --git a/src/Message/CompleteHOARequest.php b/src/Message/CompleteHOARequest.php index 7b28d9c..bf71f61 100644 --- a/src/Message/CompleteHOARequest.php +++ b/src/Message/CompleteHOARequest.php @@ -69,6 +69,18 @@ public function getData() return $data; } + /** + * Overriding to provide a more precise return type + * @return CompleteHOAResponse + */ + public function send() + { + /** + * @var CompleteHOAResponse + */ + return parent::send(); + } + protected function buildResponse($response) { return new CompleteHOAResponse($this, $response); diff --git a/src/Message/CreatePayPalSubscriptionRequest.php b/src/Message/CreatePayPalSubscriptionRequest.php index fc22f1f..7bd6118 100644 --- a/src/Message/CreatePayPalSubscriptionRequest.php +++ b/src/Message/CreatePayPalSubscriptionRequest.php @@ -133,6 +133,18 @@ public function getData($paymentMethodType = self::PAYMENT_METHOD_CREDIT_CARD) return parent::getData(self::PAYMENT_METHOD_PAYPAL); } + /** + * Overriding to provide a more precise return type + * @return CreatePayPalSubscriptionResponse + */ + public function send() + { + /** + * @var CreatePayPalSubscriptionResponse + */ + return parent::send(); + } + /** * Use a special response object for PayPal subscription requests. * diff --git a/src/Message/PayPalPurchaseRequest.php b/src/Message/PayPalPurchaseRequest.php index 3967003..37a6f02 100644 --- a/src/Message/PayPalPurchaseRequest.php +++ b/src/Message/PayPalPurchaseRequest.php @@ -90,6 +90,18 @@ public function getData($paymentMethodType = self::PAYMENT_METHOD_CREDIT_CARD) return parent::getData(self::PAYMENT_METHOD_PAYPAL); } + /** + * Overriding to provide a more precise return type + * @return PayPalPurchaseResponse + */ + public function send() + { + /** + * @var PayPalPurchaseResponse + */ + return parent::send(); + } + /** * Use a special response object for PayPal purchase requests. * diff --git a/src/Message/RefundRequest.php b/src/Message/RefundRequest.php index bc57276..7559f79 100644 --- a/src/Message/RefundRequest.php +++ b/src/Message/RefundRequest.php @@ -239,12 +239,23 @@ public function getData() return $data; } + /** + * Overriding to provide a more precise return type + * @return RefundResponse + */ + public function send() + { + /** + * @var RefundResponse + */ + return parent::send(); + } /** * Use a special response object for Refund requests. * * @param object $response - * @return Response + * @return RefundResponse */ protected function buildResponse($response) {