From d29d6f9d0c9f42dfd6dfab822ca830266468e799 Mon Sep 17 00:00:00 2001 From: DingYi <44069836@qq.com> Date: Fri, 13 Jun 2025 17:31:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20PHP8.4=20=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98=E3=80=82=20PHP=208.4:=20=E9=9A=90?= =?UTF-8?q?=E5=BC=8F=20nullable=20=E5=8F=82=E6=95=B0=E5=A3=B0=E6=98=8E?= =?UTF-8?q?=E5=BC=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 2 +- library/think/console/Command.php | 2 +- library/think/console/output/formatter/Stack.php | 4 ++-- library/think/db/Connection.php | 4 ++-- library/think/db/Query.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/library/think/App.php b/library/think/App.php index a1b1f287..8504bb35 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -74,7 +74,7 @@ class App * @return Response * @throws Exception */ - public static function run(Request $request = null) + public static function run(?Request $request = null) { $request = is_null($request) ? Request::instance() : $request; diff --git a/library/think/console/Command.php b/library/think/console/Command.php index d0caad2f..0f8bfd0d 100644 --- a/library/think/console/Command.php +++ b/library/think/console/Command.php @@ -72,7 +72,7 @@ class Command * 设置控制台 * @param Console $console */ - public function setConsole(Console $console = null) + public function setConsole(?Console $console = null) { $this->console = $console; } diff --git a/library/think/console/output/formatter/Stack.php b/library/think/console/output/formatter/Stack.php index 4864a3f2..214ea3ae 100644 --- a/library/think/console/output/formatter/Stack.php +++ b/library/think/console/output/formatter/Stack.php @@ -28,7 +28,7 @@ class Stack * 构造方法 * @param Style|null $emptyStyle */ - public function __construct(Style $emptyStyle = null) + public function __construct(?Style $emptyStyle = null) { $this->emptyStyle = $emptyStyle ?: new Style(); $this->reset(); @@ -57,7 +57,7 @@ class Stack * @return Style * @throws \InvalidArgumentException */ - public function pop(Style $style = null) + public function pop(?Style $style = null) { if (empty($this->styles)) { return $this->emptyStyle; diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index 578cc8f9..1e132d56 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -406,7 +406,7 @@ abstract class Connection * @throws PDOException * @throws \Exception */ - public function execute($sql, $bind = [], Query $query = null) + public function execute($sql, $bind = [], ?Query $query = null) { $this->initConnect(true); if (!$this->linkID) { @@ -738,7 +738,7 @@ abstract class Connection * @param array $sqlArray SQL批处理指令 * @return boolean */ - public function batchQuery($sqlArray = [], $bind = [], Query $query = null) + public function batchQuery($sqlArray = [], $bind = [], ?Query $query = null) { if (!is_array($sqlArray)) { return false; diff --git a/library/think/db/Query.php b/library/think/db/Query.php index 4aa74eba..89fc0289 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -62,7 +62,7 @@ class Query * @param Connection $connection 数据库对象实例 * @param Model $model 模型对象 */ - public function __construct(Connection $connection = null, $model = null) + public function __construct(?Connection $connection = null, $model = null) { $this->connection = $connection ?: Db::connect([], true); $this->prefix = $this->connection->getConfig('prefix');