0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Laravel] Declaration of Illuminate\Container\Container must be compatible with にハマったのでメモ

Posted at

laravel でcomposer update したら、

PHP Fatal error:  Declaration of Illuminate\Container\Container::get($id) must be compatible with Psr\Container\ContainerInterface::get(string $id)

とエラーが発生したのでその解決方法をメモ

解決策

composer.json の設定をミスったのかとか
composer のchache-clear とか
composer.lockとvendorを削除して、再度、composer install とか
bootstrap/chacheのファイルを削除とか
いろいろ試したが全く解決せず

数時間、格闘した末、
あらためてエラー内容をみると、

Psr\Container\ContainerInterface::get(string $id)

と互換性がないといっている、

つまり、

Illuminate\Container\Container::get($id)

Illuminate\Container\Containerクラスのgetメソッドに、タイプヒンティングがないのでエラーになっていました

取り急ぎの対応として
Illuminate\Container\Container:592あたり


public function get(string $id)

string を追加するとエラー解消

この対応方法でいいのかはわからないが、
緊急で対応する必要がある方は、参考にしてください。。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?