Skip to content

Commit 6e1e70c

Browse files
jhoaraupphdelaforce-payplug
authored andcommitted
PRE-2923 : Make lib compatible with PHP 8.4
1 parent 8e2aebe commit 6e1e70c

18 files changed

Lines changed: 49 additions & 47 deletions

lib/Payplug/AccountingReport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class AccountingReport
1616
*
1717
* @throws Exception\ConfigurationNotSetException
1818
*/
19-
public static function retrieve($reportId, Payplug $payplug = null)
19+
public static function retrieve($reportId, ?Payplug $payplug = null)
2020
{
2121
return Resource\AccountingReport::retrieve($reportId, $payplug);
2222
}
@@ -31,7 +31,7 @@ public static function retrieve($reportId, Payplug $payplug = null)
3131
*
3232
* @throws Exception\ConfigurationNotSetException
3333
*/
34-
public static function create(array $data, Payplug $payplug = null)
34+
public static function create(array $data, ?Payplug $payplug = null)
3535
{
3636
return Resource\AccountingReport::create($data, $payplug);
3737
}

lib/Payplug/Authentication.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static function getKeysByLogin($email, $password)
4343
* @throws Exception\ConfigurationNotSetException
4444
* @throws ConfigurationException
4545
*/
46-
public static function getAccount(Payplug $payplug = null)
46+
public static function getAccount(?Payplug $payplug = null)
4747
{
4848
if ($payplug === null) {
4949
$payplug = Payplug::getDefaultConfiguration();
@@ -66,7 +66,7 @@ public static function getAccount(Payplug $payplug = null)
6666
* @throws Exception\ConfigurationNotSetException
6767
* @throws ConfigurationException
6868
*/
69-
public static function getPermissions(Payplug $payplug = null)
69+
public static function getPermissions(?Payplug $payplug = null)
7070
{
7171
if ($payplug === null) {
7272
$payplug = Payplug::getDefaultConfiguration();
@@ -117,7 +117,7 @@ public static function getPermissionsByLogin($email, $password)
117117
*createClientIdAndSecret
118118
* @throws Exception
119119
*/
120-
public static function getPublishableKeys(Payplug $payplug = null)
120+
public static function getPublishableKeys(?Payplug $payplug = null)
121121
{
122122
if ($payplug === null) {
123123
$payplug = Payplug::getDefaultConfiguration();
@@ -262,7 +262,7 @@ private static function validateToken(Payplug $payplug)
262262
* @throws Exception\HttpException
263263
* @throws Exception\UnexpectedAPIResponseException
264264
*/
265-
public static function createClientIdAndSecret($company_id = '', $client_name = '', $mode = '', $session = null, Payplug $payplug = null)
265+
public static function createClientIdAndSecret($company_id = '', $client_name = '', $mode = '', $session = null, ?Payplug $payplug = null)
266266
{
267267
if ($payplug === null) {
268268
$payplug = Payplug::getDefaultConfiguration();

lib/Payplug/Card.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Card
1616
*
1717
* @throws Exception\ConfigurationNotSetException
1818
*/
19-
public static function delete($card, Payplug $payplug = null)
19+
public static function delete($card, ?Payplug $payplug = null)
2020
{
2121
return Resource\Card::deleteCard($card, $payplug);
2222
}

lib/Payplug/Core/HttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class HttpClient
3939
*
4040
* @param Payplug\Payplug $authentication the client configuration
4141
*/
42-
public function __construct(Payplug\Payplug $authentication = null)
42+
public function __construct(?Payplug\Payplug $authentication = null)
4343
{
4444
$this->_configuration = $authentication;
4545
}
@@ -232,7 +232,7 @@ public static function getUserAgent()
232232
private function request(
233233
$httpVerb,
234234
$resource,
235-
array $data = null,
235+
?array $data = null,
236236
$authenticated = true,
237237
$cookie = null,
238238
$headersParams = null,

lib/Payplug/InstallmentPlan.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class InstallmentPlan
1616
*
1717
* @throws Exception\ConfigurationNotSetException
1818
*/
19-
public static function retrieve($installmentPlanId, Payplug $payplug = null)
19+
public static function retrieve($installmentPlanId, ?Payplug $payplug = null)
2020
{
2121
return Resource\InstallmentPlan::retrieve($installmentPlanId, $payplug);
2222
}
@@ -31,7 +31,7 @@ public static function retrieve($installmentPlanId, Payplug $payplug = null)
3131
*
3232
* @throws Exception\ConfigurationNotSetException
3333
*/
34-
public static function abort($installmentPlanId, Payplug $payplug = null)
34+
public static function abort($installmentPlanId, ?Payplug $payplug = null)
3535
{
3636
$installmentPlan = Resource\InstallmentPlan::fromAttributes(array('id' => $installmentPlanId));
3737
return $installmentPlan->abort($payplug);
@@ -47,7 +47,7 @@ public static function abort($installmentPlanId, Payplug $payplug = null)
4747
*
4848
* @throws Exception\ConfigurationNotSetException
4949
*/
50-
public static function create(array $data, Payplug $payplug = null)
50+
public static function create(array $data, ?Payplug $payplug = null)
5151
{
5252
return Resource\InstallmentPlan::create($data, $payplug);
5353
}

lib/Payplug/OneySimulation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class OneySimulation {
1616
* @throws Exception\HttpException
1717
* @throws Exception\UnexpectedAPIResponseException
1818
*/
19-
public static function getSimulations($data, Payplug $payplug = null)
19+
public static function getSimulations($data, ?Payplug $payplug = null)
2020
{
2121
return Resource\OneySimulationResource::getSimulations($data, $payplug);
2222
}

lib/Payplug/Payment.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Payment
1616
*
1717
* @throws Exception\ConfigurationNotSetException
1818
*/
19-
public static function retrieve($paymentId, Payplug $payplug = null)
19+
public static function retrieve($paymentId, ?Payplug $payplug = null)
2020
{
2121
return Resource\Payment::retrieve($paymentId, $payplug);
2222
}
@@ -31,7 +31,7 @@ public static function retrieve($paymentId, Payplug $payplug = null)
3131
*
3232
* @throws Exception\ConfigurationNotSetException
3333
*/
34-
public static function abort($paymentId, Payplug $payplug = null)
34+
public static function abort($paymentId, ?Payplug $payplug = null)
3535
{
3636
$payment = Resource\Payment::fromAttributes(array('id' => $paymentId));
3737
return $payment->abort($payplug);
@@ -47,7 +47,7 @@ public static function abort($paymentId, Payplug $payplug = null)
4747
*
4848
* @throws Exception\ConfigurationNotSetException
4949
*/
50-
public static function capture($paymentId, Payplug $payplug = null)
50+
public static function capture($paymentId, ?Payplug $payplug = null)
5151
{
5252
$payment = Resource\Payment::fromAttributes(array('id' => $paymentId));
5353
return $payment->capture($payplug);
@@ -63,7 +63,7 @@ public static function capture($paymentId, Payplug $payplug = null)
6363
*
6464
* @throws Exception\ConfigurationNotSetException
6565
*/
66-
public static function create(array $data, Payplug $payplug = null)
66+
public static function create(array $data, ?Payplug $payplug = null)
6767
{
6868
return Resource\Payment::create($data, $payplug);
6969
}
@@ -80,7 +80,7 @@ public static function create(array $data, Payplug $payplug = null)
8080
* @throws Exception\InvalidPaymentException
8181
* @throws Exception\UnexpectedAPIResponseException
8282
*/
83-
public static function listPayments($perPage = null, $page = null, Payplug $payplug = null)
83+
public static function listPayments($perPage = null, $page = null, ?Payplug $payplug = null)
8484
{
8585
return Resource\Payment::listPayments($perPage, $page, $payplug);
8686
}

lib/Payplug/PluginTelemetry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class PluginTelemetry
2020
* @throws Exception\HttpException
2121
* @throws Exception\UnexpectedAPIResponseException
2222
*/
23-
public static function send($data = '{}', Payplug $payplug = null)
23+
public static function send($data = '{}', ?Payplug $payplug = null)
2424
{
2525
$data = json_decode($data, true);
2626

lib/Payplug/Refund.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Refund {
1515
* @return null|Refund the refund object
1616
* @throws Exception\ConfigurationNotSetException
1717
*/
18-
public static function create($payment, array $data = null, Payplug $payplug = null)
18+
public static function create($payment, ?array $data = null, ?Payplug $payplug = null)
1919
{
2020
return Resource\Refund::create($payment, $data, $payplug);
2121
}
@@ -31,7 +31,7 @@ public static function create($payment, array $data = null, Payplug $payplug = n
3131
*
3232
* @throws Exception\ConfigurationNotSetException
3333
*/
34-
public static function retrieve($payment, $refundId, Payplug $payplug = null)
34+
public static function retrieve($payment, $refundId, ?Payplug $payplug = null)
3535
{
3636
return Resource\Refund::retrieve($payment, $refundId, $payplug);
3737
}
@@ -47,7 +47,7 @@ public static function retrieve($payment, $refundId, Payplug $payplug = null)
4747
* @throws Exception\ConfigurationNotSetException
4848
* @throws Exception\UnexpectedAPIResponseException
4949
*/
50-
public static function listRefunds($payment, Payplug $payplug = null)
50+
public static function listRefunds($payment, ?Payplug $payplug = null)
5151
{
5252
return Resource\Refund::listRefunds($payment, $payplug);
5353
}

lib/Payplug/Resource/AccountingReport.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static function fromAttributes(array $attributes)
3131
*
3232
* @throws Payplug\Exception\ConfigurationNotSetException
3333
*/
34-
public static function retrieve($reportId, Payplug\Payplug $payplug = null)
34+
public static function retrieve($reportId, ?Payplug\Payplug $payplug = null)
3535
{
3636
if ($payplug === null) {
3737
$payplug = Payplug\Payplug::getDefaultConfiguration();
@@ -55,7 +55,7 @@ public static function retrieve($reportId, Payplug\Payplug $payplug = null)
5555
*
5656
* @throws Payplug\Exception\ConfigurationNotSetException
5757
*/
58-
public static function create(array $data, Payplug\Payplug $payplug = null)
58+
public static function create(array $data, ?Payplug\Payplug $payplug = null)
5959
{
6060
if ($payplug === null) {
6161
$payplug = Payplug\Payplug::getDefaultConfiguration();
@@ -79,7 +79,7 @@ public static function create(array $data, Payplug\Payplug $payplug = null)
7979
*
8080
* @throws Payplug\Exception\UndefinedAttributeException when the local resource is invalid.
8181
*/
82-
function getConsistentResource(Payplug\Payplug $payplug = null)
82+
function getConsistentResource(?Payplug\Payplug $payplug = null)
8383
{
8484
if (!array_key_exists('id', $this->_attributes)) {
8585
throw new Payplug\Exception\UndefinedAttributeException('The id of the accounting report is not set.');

0 commit comments

Comments
 (0)