From 4f6f15fd12360d9fdfbf1280d370db66cbffd024 Mon Sep 17 00:00:00 2001 From: php24 Date: Sat, 28 Mar 2026 15:06:24 +0800 Subject: [PATCH] Fix ReflectionMethod::setAccessible deprecation in PHP 8.5 --- src/Commands/MakeCrudCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Commands/MakeCrudCommand.php b/src/Commands/MakeCrudCommand.php index c315515..19833a4 100644 --- a/src/Commands/MakeCrudCommand.php +++ b/src/Commands/MakeCrudCommand.php @@ -697,7 +697,9 @@ protected function generateModel( $reflection = new \ReflectionClass($modelCommand); $methodName = $ormType === OrmType::THINKORM ? 'createTpModel' : 'createModel'; $method = $reflection->getMethod($methodName); - $method->setAccessible(true); + if (PHP_VERSION_ID < 80100) { // PHP < 8.1 才调用 + $method->setAccessible(true); + } $method->invoke($modelCommand, $class, $namespace, $file, $connection, $table, $output); return $this->toRelativePath($file);