laravel 错误:调用未定义的方法ReflectionFunction::isAnonymous()

ss2ws0br  于 2023-04-22  发布在  其他
关注(0)|答案(1)|浏览(140)

我正在尝试安装Laravel新项目并得到此错误

> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   Error
 Error

  Call to undefined method ReflectionFunction::isAnonymous()

  at vendor/laravel/framework/src/Illuminate/Container/Container.php:681
    677▕     protected function getClassForCallable($callback)
    678▕     {
    679▕         if (PHP_VERSION_ID >= 80200) {
    680▕             if (is_callable($callback) &&
  ➜ 681▕                 ! ($reflector = new ReflectionFunction($callback(...)))->isAnonymous()) {
    682▕                 return $reflector->getClosureScopeClass()->name ?? false;
    683▕             }
    684▕
    685▕             return false;

      +3 vendor frames

  4   [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Illuminate\Database\DatabaseServiceProvider))
      +5 vendor frames

  10  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))



  4   artisan:51
      Illuminate\Foundation\Console\Kernel::terminate(Object(Symfony\Component\Console\Input\ArgvInput))

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

“php”:“^8.1”
“laravel/framework”:“^10.8”
Composer版本2.5.5
已完成
composer clearcache
composer update
composer global update
composer selfupdate
composer self-update --rollback等...
如果我运行任何artisan命令,它会显示相同的错误。

dzhpxtsq

dzhpxtsq1#

Laravel 10.x需要最低PHP版本8.1。请检查您的PHP版本

相关问题