Skip to content

Commit a4829d6

Browse files
committed
[CC-1903] explicitly set nullable string parameter.
1 parent 31b3140 commit a4829d6

23 files changed

+68
-70
lines changed

src/Adapter/ApplepayAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function validMerchantValidationDomain(string $merchantValidationURL): bo
6767
* This is necessary if the ssl cert file doesn't contain key already.
6868
* @param string|null $caCert Path to CA certificate.
6969
*/
70-
public function init(string $sslCert, string $sslKey = null, string $caCert = null): void
70+
public function init(string $sslCert, ?string $sslKey = null, ?string $caCert = null): void
7171
{
7272
$timeout = EnvironmentService::getTimeout();
7373
$curlVerbose = EnvironmentService::isCurlVerbose();

src/Adapter/CurlAdapter.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010

1111
namespace UnzerSDK\Adapter;
1212

13-
use UnzerSDK\Unzer;
14-
use UnzerSDK\Services\EnvironmentService;
15-
use UnzerSDK\Exceptions\UnzerApiException;
1613
use RuntimeException;
17-
14+
use UnzerSDK\Exceptions\UnzerApiException;
15+
use UnzerSDK\Services\EnvironmentService;
16+
use UnzerSDK\Unzer;
1817
use function extension_loaded;
1918
use function in_array;
2019

@@ -37,7 +36,7 @@ public function __construct()
3736
/**
3837
* {@inheritDoc}
3938
*/
40-
public function init(string $url, string $payload = null, string $httpMethod = HttpAdapterInterface::REQUEST_GET): void
39+
public function init(string $url, ?string $payload = null, string $httpMethod = HttpAdapterInterface::REQUEST_GET): void
4140
{
4241
$timeout = EnvironmentService::getTimeout();
4342
$curlVerbose = EnvironmentService::isCurlVerbose();

src/Adapter/HttpAdapterInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface HttpAdapterInterface
2525
* @param string|null $payload Json encoded payload string.
2626
* @param string $httpMethod The Http method to perform.
2727
*/
28-
public function init(string $url, string $payload = null, string $httpMethod = HttpAdapterInterface::REQUEST_GET): void;
28+
public function init(string $url, ?string $payload = null, string $httpMethod = HttpAdapterInterface::REQUEST_GET): void;
2929

3030
/**
3131
* Executes the request and returns the response.

src/Exceptions/UnzerApiException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class UnzerApiException extends Exception
2929
* @param string $code
3030
* @param string|null $errorId
3131
*/
32-
public function __construct($merchantMessage = '', $clientMessage = '', $code = null, string $errorId = null)
32+
public function __construct($merchantMessage = '', $clientMessage = '', $code = null, ?string $errorId = null)
3333
{
3434
$merchantMessage = empty($merchantMessage) ? static::MESSAGE : $merchantMessage;
3535
$this->clientMessage = empty($clientMessage) ? static::CLIENT_MESSAGE : $clientMessage;

src/Interfaces/CancelServiceInterface.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
namespace UnzerSDK\Interfaces;
1010

11+
use RuntimeException;
1112
use UnzerSDK\Constants\CancelReasonCodes;
1213
use UnzerSDK\Exceptions\UnzerApiException;
1314
use UnzerSDK\Resources\Payment;
1415
use UnzerSDK\Resources\TransactionTypes\Authorization;
1516
use UnzerSDK\Resources\TransactionTypes\Cancellation;
1617
use UnzerSDK\Resources\TransactionTypes\Charge;
17-
use RuntimeException;
1818

1919
interface CancelServiceInterface
2020
{
@@ -68,8 +68,8 @@ public function cancelChargeById(
6868
$payment,
6969
string $chargeId,
7070
float $amount = null,
71-
string $reasonCode = null,
72-
string $referenceText = null,
71+
?string $reasonCode = null,
72+
?string $referenceText = null,
7373
float $amountNet = null,
7474
float $amountVat = null
7575
): Cancellation;
@@ -94,8 +94,8 @@ public function cancelChargeById(
9494
public function cancelCharge(
9595
Charge $charge,
9696
float $amount = null,
97-
string $reasonCode = null,
98-
string $referenceText = null,
97+
?string $reasonCode = null,
98+
?string $referenceText = null,
9999
float $amountNet = null,
100100
float $amountVat = null
101101
): Cancellation;
@@ -121,7 +121,7 @@ public function cancelPayment(
121121
$payment,
122122
float $amount = null,
123123
?string $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL,
124-
string $referenceText = null,
124+
?string $referenceText = null,
125125
float $amountNet = null,
126126
float $amountVat = null
127127
): array;

src/Interfaces/PaymentServiceInterface.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace UnzerSDK\Interfaces;
1010

1111
use DateTime;
12+
use RuntimeException;
1213
use UnzerSDK\Exceptions\UnzerApiException;
1314
use UnzerSDK\Resources\AbstractUnzerResource;
1415
use UnzerSDK\Resources\Basket;
@@ -24,7 +25,6 @@
2425
use UnzerSDK\Resources\TransactionTypes\Charge;
2526
use UnzerSDK\Resources\TransactionTypes\Payout;
2627
use UnzerSDK\Resources\TransactionTypes\Shipment;
27-
use RuntimeException;
2828

2929
interface PaymentServiceInterface
3030
{
@@ -230,8 +230,8 @@ public function performChargeOnPayment(
230230
public function chargeAuthorization(
231231
$payment,
232232
float $amount = null,
233-
string $orderId = null,
234-
string $invoiceId = null
233+
?string $orderId = null,
234+
?string $invoiceId = null
235235
): Charge;
236236

237237
/**
@@ -253,8 +253,8 @@ public function chargeAuthorization(
253253
public function chargePayment(
254254
$payment,
255255
float $amount = null,
256-
string $orderId = null,
257-
string $invoiceId = null
256+
?string $orderId = null,
257+
?string $invoiceId = null
258258
): Charge;
259259

260260
/**
@@ -303,7 +303,7 @@ public function payout(
303303
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
304304
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
305305
*/
306-
public function ship($payment, string $invoiceId = null, string $orderId = null): Shipment;
306+
public function ship($payment, ?string $invoiceId = null, ?string $orderId = null): Shipment;
307307

308308
/**
309309
* Initializes a PayPage for charge transaction and returns the PayPage resource.

src/Interfaces/ResourceServiceInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function fetchPayout($payment): Payout;
5757
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
5858
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
5959
*/
60-
public function activateRecurringPayment($paymentType, string $returnUrl, string $recurrenceType = null): Recurring;
60+
public function activateRecurringPayment($paymentType, string $returnUrl, ?string $recurrenceType = null): Recurring;
6161

6262
/**
6363
* Fetch and return payment by given payment id or payment object.

src/Resources/EmbeddedResources/GooglePay/SignedMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class SignedMessage extends AbstractUnzerResource
2020
* @param string $ephemeralPublicKey
2121
* @param string $encryptedMessage
2222
*/
23-
public function __construct(string $tag = null, string $ephemeralPublicKey = null, string $encryptedMessage = null)
23+
public function __construct(string $tag = null, ?string $ephemeralPublicKey = null, ?string $encryptedMessage = null)
2424
{
2525
$this->tag = $tag;
2626
$this->ephemeralPublicKey = $ephemeralPublicKey;

src/Resources/InstalmentPlan.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace UnzerSDK\Resources;
44

55
use DateTime;
6+
use stdClass;
67
use UnzerSDK\Adapter\HttpAdapterInterface;
78
use UnzerSDK\Resources\PaymentTypes\BasePaymentType;
89
use UnzerSDK\Traits\CanAuthorizeWithCustomer;
9-
use stdClass;
1010

1111
/**
1212
* Resource representing the installment plan for Installment Secured.
@@ -78,7 +78,7 @@ class InstalmentPlan extends BasePaymentType
7878
*/
7979
public function __construct(
8080
int $numberOfRates = null,
81-
string $dayOfPurchase = null,
81+
?string $dayOfPurchase = null,
8282
float $totalPurchaseAmount = null,
8383
float $totalInterestAmount = null,
8484
float $totalAmount = null,

src/Resources/Payment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ public function charge(float $amount = null): Charge
881881
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
882882
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
883883
*/
884-
public function ship(string $invoiceId = null, string $orderId = null)
884+
public function ship(string $invoiceId = null, ?string $orderId = null)
885885
{
886886
return $this->getUnzerObject()->ship($this, $invoiceId, $orderId);
887887
}

0 commit comments

Comments
 (0)