symfony: Declaration of TranslatorInterface::setLocale($locale) must be compatible with LocaleAwareInterface::setLocale(string $locale)
Symfony version(s) affected: “^4.3.4”
"name": "symfony/translation-contracts",
"version": "v2.0.0",
Description
"message": "Declaration of Symfony\\Component\\Translation\\TranslatorInterface::setLocale($locale) must be compatible with Symfony\\Contracts\\Translation\\LocaleAwareInterface::setLocale(string $locale)",
"exception": "Symfony\\Component\\Debug\\Exception\\FatalErrorException",
"file": "D:\\abc\\vendor\\symfony\\translation\\TranslatorInterface.php",
"line": 24,
"trace": []
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (5 by maintainers)
It looks like you ran
composer update
with a different PHP version than the one that is used to execute the application (see also #34482).Another solution is to do following
in
Symfony/translation-contracts/composer.json
editto
then add
"symfony/translation-contracts": "^1.1.6"
toproject/composer.json
after that runcomposer update
it should work 😃source: https://laracasts.com/discuss/channels/laravel/installation-fresh-laravel?page=1#reply=558018
FYI, this is not a good way. I just wanted it to work for a demo and didn’t had time to mess up env with different php. Do not use in production or even in development.
Modifying vendor files is never the solution. Instead, make sure that you run
composer update
with a PHP version that is not newer than the one used to run your application or configure the target PHP version using the platform config.