首页 > 解决方案 > 任何工匠命令上的 TypeError

问题描述

由于当前存在漏洞(https://blog.laravel.com/laravel-cookie-security-releases),今天早上我将 Laravel 升级到了 7.23.0 版本。但是现在我收到每个 Artisan Command 的以下错误消息:

php artisan package:discover --ansi

   TypeError 

  Illuminate\Container\Container::bind(): Argument #2 ($concrete) must be of type Closure|string|null

  at vendor/laravel/framework/src/Illuminate/Container/Container.php:238
    234|         // bound into this container to the abstract type and we will just wrap it
    235|         // up inside its own Closure to give us more convenience when extending.
    236|         if (! $concrete instanceof Closure) {
    237|             if (! is_string($concrete)) {
  > 238|                 throw new \TypeError(self::class.'::bind(): Argument #2 ($concrete) must be of type Closure|string|null');
    239|             }
    240| 
    241|             $concrete = $this->getClosure($abstract, $concrete);
    242|         }

      +11 vendor frames 
  12  [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Facade\Ignition\IgnitionServiceProvider))

      +5 vendor frames 
  18  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

由于我认为这将是一个更明显的错误,并且我在 GitHub 上没有发现问题,所以我没有打开一个新问题并在这里寻求帮助 :)

但是,我真的不知道究竟是什么导致了这个问题。

标签: phplaravel

解决方案


感谢 Abdel-aziz hassan 的链接(https://github.com/laravel/framework/pull/33539)。

我发现门面/点火器是旧版本的。我更新了它,现在它可以工作了。

多谢你们!


推荐阅读