From 0216ba50273067594907178ea299c86ed6a39656 Mon Sep 17 00:00:00 2001 From: Karson Date: Tue, 17 Jun 2025 11:27:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96PHP8.4=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Collection.php | 4 ++-- library/think/Controller.php | 2 +- library/think/exception/HttpException.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/think/Collection.php b/library/think/Collection.php index 0ff1dfc0..3c1f8010 100644 --- a/library/think/Collection.php +++ b/library/think/Collection.php @@ -263,7 +263,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria * @param callable|null $callback 回调函数 * @return static */ - public function filter(callable $callback = null) + public function filter(?callable $callback = null) { return new static(array_filter($this->items, $callback ?: null)); } @@ -317,7 +317,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria * @param callable|null $callback 回调函数 * @return static */ - public function sort(callable $callback = null) + public function sort(?callable $callback = null) { $items = $this->items; $callback = $callback ?: function ($a, $b) { diff --git a/library/think/Controller.php b/library/think/Controller.php index 77225b73..b214c48f 100644 --- a/library/think/Controller.php +++ b/library/think/Controller.php @@ -50,7 +50,7 @@ class Controller * @access public * @param Request $request Request 对象 */ - public function __construct(Request $request = null) + public function __construct(?Request $request = null) { $this->view = View::instance(Config::get('template'), Config::get('view_replace_str')); $this->request = is_null($request) ? Request::instance() : $request; diff --git a/library/think/exception/HttpException.php b/library/think/exception/HttpException.php index 01a27fc2..6f2807c5 100644 --- a/library/think/exception/HttpException.php +++ b/library/think/exception/HttpException.php @@ -16,7 +16,7 @@ class HttpException extends \RuntimeException private $statusCode; private $headers; - public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = [], $code = 0) + public function __construct($statusCode, $message = null, ?\Exception $previous = null, array $headers = [], $code = 0) { $this->statusCode = $statusCode; $this->headers = $headers;