Laravel6安装完碰到如下报错
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里面加入
"symfony/translation-contracts": "^1.1.6"
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/tinker": "^1.0",
},
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/tinker": "^1.0",
"symfony/translation-contracts": "^1.1.6",
},
之后执行命令
composer update
composer dump-autoload