错误信息:
Symfony\Component\Debug\Exception\FatalErrorException
Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale)
解决方案:
- 打开项目根目录下的 composer.json 文件
- 在 require 中添加 “symfony/translation”: “4.3.8”
注意一定是"require": { "php": "^7.2", "fideloper/proxy": "^4.0", "laravel/framework": "^6.2", "laravel/tinker": "^2.0", "symfony/translation": "4.3.8" },
4.3.8
,我试了 4.4,5.0,5.0.2 都不行。 - 然后保存 json 文件
- 进入项目根目录
- 执行以下升级命令
composer update
- 刷新页面,错误消失