Skip to content

Commit 4c110ad

Browse files
authored
fix: use explicit nullable types for PHP 8.4 compatibility (#309)
Replace all remaining implicit nullable parameter types with explicit nullable type declarations to resolve PHP 8.4 deprecation warnings. PR #306 previously fixed src/Billable.php; this commit addresses the remaining 13 occurrences across exception constructors, interval generators, Invoice methods, and test helpers.
1 parent 5e78f90 commit 4c110ad

14 files changed

Lines changed: 16 additions & 16 deletions

src/Exceptions/AmountExceedsMolliePaymentMethodLimit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AmountExceedsMolliePaymentMethodLimit extends Exception
1414
* @param int $code
1515
* @param Throwable|null $previous
1616
*/
17-
public function __construct(string $message = 'The order total is greater than the total accepted by Mollie', int $code = 500, Throwable $previous = null)
17+
public function __construct(string $message = 'The order total is greater than the total accepted by Mollie', int $code = 500, ?Throwable $previous = null)
1818
{
1919
parent::__construct($message, $code, $previous);
2020
}

src/Exceptions/CouponException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CouponException extends Exception
1414
* @param int $code
1515
* @param \Throwable|null $previous
1616
*/
17-
public function __construct(string $message, int $code = 404, Throwable $previous = null)
17+
public function __construct(string $message, int $code = 404, ?Throwable $previous = null)
1818
{
1919
parent::__construct($message, $code, $previous);
2020
}

src/Exceptions/CouponNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class CouponNotFoundException extends CouponException
1313
* @param int $code
1414
* @param Throwable|null $previous
1515
*/
16-
public function __construct(string $message = 'Coupon not found', int $code = 404, Throwable $previous = null)
16+
public function __construct(string $message = 'Coupon not found', int $code = 404, ?Throwable $previous = null)
1717
{
1818
parent::__construct($message, $code, $previous);
1919
}

src/Exceptions/CurrencyMismatchException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CurrencyMismatchException extends Exception
1414
* @param int $code
1515
* @param Throwable|null $previous
1616
*/
17-
public function __construct(string $message = 'Currencies do not match', int $code = 404, Throwable $previous = null)
17+
public function __construct(string $message = 'Currencies do not match', int $code = 404, ?Throwable $previous = null)
1818
{
1919
parent::__construct($message, $code, $previous);
2020
}

src/Exceptions/InvalidMandateException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class InvalidMandateException extends Exception
1414
* @param int $code
1515
* @param Throwable|null $previous
1616
*/
17-
public function __construct(string $message = 'Invalid customer mandate', int $code = 404, Throwable $previous = null)
17+
public function __construct(string $message = 'Invalid customer mandate', int $code = 404, ?Throwable $previous = null)
1818
{
1919
parent::__construct($message, $code, $previous);
2020
}

src/Exceptions/MandateIsNotYetFinalizedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class MandateIsNotYetFinalizedException extends Exception
1414
* @param int $code
1515
* @param Throwable|null $previous
1616
*/
17-
public function __construct(string $message = 'The customer mandate is still pending', int $code = 404, Throwable $previous = null)
17+
public function __construct(string $message = 'The customer mandate is still pending', int $code = 404, ?Throwable $previous = null)
1818
{
1919
parent::__construct($message, $code, $previous);
2020
}

src/Exceptions/OrderRetryRequiresStatusFailedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class OrderRetryRequiresStatusFailedException extends Exception
1414
* @param int $code
1515
* @param Throwable|null $previous
1616
*/
17-
public function __construct(string $message = 'The order status is not failed', int $code = 500, Throwable $previous = null)
17+
public function __construct(string $message = 'The order status is not failed', int $code = 500, ?Throwable $previous = null)
1818
{
1919
parent::__construct($message, $code, $previous);
2020
}

src/Exceptions/PlanNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class PlanNotFoundException extends Exception
1414
* @param int $code
1515
* @param Throwable|null $previous
1616
*/
17-
public function __construct(string $message = 'Plan not found', int $code = 404, Throwable $previous = null)
17+
public function __construct(string $message = 'Plan not found', int $code = 404, ?Throwable $previous = null)
1818
{
1919
parent::__construct($message, $code, $previous);
2020
}

src/Order/Invoice.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ public function view(array $data = [], string $view = self::DEFAULT_VIEW)
461461
* @param \Dompdf\Options $options
462462
* @return string
463463
*/
464-
public function pdf(array $data = [], string $view = self::DEFAULT_VIEW, Options $options = null)
464+
public function pdf(array $data = [], string $view = self::DEFAULT_VIEW, ?Options $options = null)
465465
{
466466
if (!defined('DOMPDF_ENABLE_AUTOLOAD')) {
467467
define('DOMPDF_ENABLE_AUTOLOAD', false);
@@ -482,7 +482,7 @@ public function pdf(array $data = [], string $view = self::DEFAULT_VIEW, Options
482482
* @param \Dompdf\Options $options
483483
* @return \Symfony\Component\HttpFoundation\Response
484484
*/
485-
public function download(array $data = [], string $view = self::DEFAULT_VIEW, Options $options = null)
485+
public function download(array $data = [], string $view = self::DEFAULT_VIEW, ?Options $options = null)
486486
{
487487
$filename = implode('_', [
488488
$this->id,

src/Plan/AdvancedIntervalGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(array $configuration)
2626
* @param \Laravel\Cashier\Subscription|null $subscription
2727
* @return \Carbon\Carbon|\Carbon\Traits\Modifiers
2828
*/
29-
public function getEndOfNextSubscriptionCycle(Subscription $subscription = null)
29+
public function getEndOfNextSubscriptionCycle(?Subscription $subscription = null)
3030
{
3131
$cycle_ends_at = $subscription->cycle_ends_at ?? now();
3232
$subscription_date = $this->startOfTheSubscription($subscription);

0 commit comments

Comments
 (0)