From 21e28ad71703295a64b3c00c7af8fb8e82bae02f Mon Sep 17 00:00:00 2001 From: Ben Faerber Date: Thu, 24 Apr 2025 23:31:40 -0600 Subject: [PATCH] Fix: Make custom exceptions example nullable --- language/exceptions.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/language/exceptions.xml b/language/exceptions.xml index 39b54c943450..d81e4e8b38ed 100644 --- a/language/exceptions.xml +++ b/language/exceptions.xml @@ -386,7 +386,7 @@ class Exception implements Throwable private $trace; // backtrace private $previous; // previous exception if nested exception - public function __construct($message = '', $code = 0, Throwable $previous = null); + public function __construct($message = '', $code = 0, ?Throwable $previous = null); final private function __clone(); // Inhibits cloning of exceptions. @@ -432,7 +432,7 @@ class Exception implements Throwable class MyException extends Exception { // Redefine the exception so message isn't optional - public function __construct($message, $code = 0, Throwable $previous = null) { + public function __construct($message, $code = 0, ?Throwable $previous = null) { // some code // make sure everything is assigned properly