Skip to content

Commit

Permalink
Specify more precise return types to help Psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
nickyr committed Nov 2, 2016
1 parent 0bbced0 commit af57caf
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,10 @@ final protected function getEndpoint()
. '.wsdl';
}

/**
* @param array
* @return Response
*/
public function sendData($data)
{
$originalWsdlCacheEnabled = ini_get('soap.wsdl_cache_enabled');
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions src/Message/CaptureRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
12 changes: 12 additions & 0 deletions src/Message/CompleteHOARequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions src/Message/CreatePayPalSubscriptionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
12 changes: 12 additions & 0 deletions src/Message/PayPalPurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
13 changes: 12 additions & 1 deletion src/Message/RefundRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit af57caf

Please sign in to comment.