framework: Declaration of TranslatorInterface::setLocale($locale) must be compatible with LocaleAwareInterface::setLocale(string $locale)

  • Laravel Version: ^6.0
  • PHP Version: 7.2
  • Symfony: ^4.3.4

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": []
    }

Steps To Reproduce:

composer update

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 17 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Had the same issue, quickest fix is to require "symfony/translation": "4.3.8" in your composer.json & run composer update

i got the same error

i solved it by add

"symfony/translation": "4.3.8"

to my composer.json file

and then run composer update

every thing work good after that

i got the same error

i solved it by add

"symfony/translation": "4.3.8"

to my composer.json file

and then run composer update

every thing work good after that

This worked for me!

Had the same issue, quickest fix is to require "symfony/translation": "4.3.8" in your composer.json & run composer update

Best solution!

Why are you downgrading whole library if you can just downgrade an interface that causes an issue? Add "symfony/translation-contracts": "^1.1.7" to your composer and run composer update, especially considering that symfony/translation clearly allows it in its composer json (if you check you will see ^1.1.6|^2 here https://packagist.org/packages/symfony/translation#v4.4.4).