laravel/framework

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

Closed this issue ยท 17 comments

  • 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

Same error here.
Laravel 5.8.*
PHP 7.3.1
Symfony/translation 4.2

composer update

@hafizu97 see also symfony/symfony#34506

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

i had the similar issue:

Symfony\Component\Debug\Exception\FatalErrorException
Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale)

same question

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!

thanks mate that worked for me too.

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

Best solution!

I received this error during installation. I don't seem to find composer.json anywhere. Am I missing anything? I'm using PHP 7.1

I received this error during installation. I don't seem to find composer.json anywhere. Am I missing anything? I'm using PHP 7.1

composer.json should be in the root directory of your laravel installation. So if your laravel app is in a folder called /Users/someuser/code/new-laravel you should find the composer.json file directly in that folder.

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!

Excelent...

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

lifesaver

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

it worked for me thanks

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).

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).

This is the most viable solution and also the one that worked for me thanks !

Hey everyone,

I'm locking this issue because it either has gone off-topic, become a dumping ground for things which shouldn't be in an issue tracker or is just too old. Please try to discuss things further on one of the below channels: