Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
erlangp opened this issue Nov 22, 2019 · 10 comments

Comments

@erlangp
Copy link

@erlangp erlangp commented Nov 22, 2019

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

This comment has been minimized.

Copy link

@shenheishe shenheishe commented Nov 22, 2019

Same problem

@xabbuh

This comment has been minimized.

Copy link
Member

@xabbuh xabbuh commented Nov 22, 2019

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

@erlangp

This comment has been minimized.

Copy link
Author

@erlangp erlangp commented Nov 22, 2019

thanks @xabbuh

@shenheishe

This comment has been minimized.

Copy link

@shenheishe shenheishe commented Nov 23, 2019

thanks @xabbuh

@sharik709

This comment has been minimized.

Copy link

@sharik709 sharik709 commented Nov 26, 2019

Another solution is to do following

in Symfony/translation-contracts/composer.json edit

"require": {
        "php": "^7.2.9"
},

to

"require": {
        "php": "^7.1.3"
},

then add "symfony/translation-contracts": "^1.1.6" to project/composer.json after that run composer update it should work :)

source: https://laracasts.com/discuss/channels/laravel/installation-fresh-laravel?page=1#reply=558018

@nikankad

This comment has been minimized.

Copy link

@nikankad nikankad commented Dec 1, 2019

@sharik709 it worked thanks!

@xabbuh

This comment has been minimized.

Copy link
Member

@xabbuh xabbuh commented Dec 1, 2019

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.

@mohammed-roccomedia

This comment has been minimized.

Copy link

@mohammed-roccomedia mohammed-roccomedia commented Dec 4, 2019

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.

can you pleas say how to update it ??

@stof

This comment has been minimized.

Copy link
Member

@stof stof commented Dec 4, 2019

how to update what ?

@pablolopezj

This comment has been minimized.

Copy link

@pablolopezj pablolopezj commented Dec 5, 2019

I had the same problem, I installed php 7.3 but when I used PHPINFO it showed me an older version 7.2 so I disabled 7.2 and activated 7.3

sudo a2dismod php7.2

sudo a2enmod php7.3

I restarted Apache and it worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.