From 6629a864f5edb5d58d942fed6f1d3c050610ad29 Mon Sep 17 00:00:00 2001 From: Mikko Pesari Date: Mon, 13 Jan 2025 15:04:49 +0200 Subject: [PATCH] fix: Implicitly nullable parameter types are deprecated in PHP 8.4 --- lib/Error.php | 2 +- tests/Argument.php | 2 +- tests/Target.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Error.php b/lib/Error.php index b280191..c938e18 100644 --- a/lib/Error.php +++ b/lib/Error.php @@ -30,7 +30,7 @@ class Error extends Exception */ public $data; - public function __construct(string $message, int $code, $data = null, Throwable $previous = null) + public function __construct(string $message, int $code, $data = null, ?Throwable $previous = null) { parent::__construct($message, $code, $previous); $this->data = $data; diff --git a/tests/Argument.php b/tests/Argument.php index c4ae806..7e985e3 100644 --- a/tests/Argument.php +++ b/tests/Argument.php @@ -13,7 +13,7 @@ class Argument */ public $aProperty; - public function __construct(string $aProperty = null) + public function __construct(?string $aProperty = null) { $this->aProperty = $aProperty; } diff --git a/tests/Target.php b/tests/Target.php index 84ece52..b203968 100644 --- a/tests/Target.php +++ b/tests/Target.php @@ -44,7 +44,7 @@ public function someMethodWithUnionTypeParamTag($arg) return 'Hello World'; } - public function someMethodWithDifferentlyTypedArgs(string $arg1 = null, int $arg2 = null) + public function someMethodWithDifferentlyTypedArgs(?string $arg1 = null, ?int $arg2 = null) { $this->calls[] = new MethodCall('someMethodWithDifferentlyTypedArgs', func_get_args()); return 'Hello World';