Symfony\Component\Debug\Exception\FatalErrorException laravel Error

I got the same error on PHP 7.2.3 after composer update (symfony\translation v4.3.8 => v4.4.0).

I solved this issue with "symfony/translation": "4.3.8" in my composer.json.

It's a bad idea to hard edit vendors files.

--

Edit:

Symfony doc says Install PHP 7.2.5 or higher, so if you don't want to add this restriction into your composer.json file, you can upgrade your PHP version to 7.2.5+ (check others libraries compatibility first).


On my server following were configurations:

PHP 7.1.26-1+ubuntu14.04.1+deb.sury.org+1 Laravel Framework 5.7.28

Solution: Added "symfony/translation": "4.3.8" in composer.json as follows

"require": {
     ...
     "symfony/translation": "4.3.8",
}

and then

composer update

or (if php version is not recommended on the server)

composer update --ignore-platform-reqs


I got the same error today and I solved it with a little editing. Just do this:
Navigate to

vendor/symfony/translation-contracts/LocaleAwareInteface.php

and delete string keyword from the setLocale() function.

If you get this error after this:

Declaration of Symfony\Component\Translation\Translator::trans($id, array $parameters = Array, $domain = NULL, $locale = NULL) must be compatible with Symfony\Contracts\Translation\TranslatorInterface::trans(string $id, array $parameters = Array, ?string $domain = NULL, ?string $locale = NULL)

Just navigate to:

vendor/symfony/translation-contracts/TranslatorInteface.php

and delete all the string keywords from the trans() function

--EDIT--

If you don't want to edit vendor files, you can use this: Open your composer.json file, and add this in "require"

"symfony/translation": "4.3.8",

Then open your terminal and type this:

composer update

Tags:

Php

Laravel