'getting error while enter Command => php artisan route:list

This laravel code is running on my localhost

when try to execute any command its throwing below error. please find me a solution why it's throwing such error

SATYA@SATYAJIT-Win MINGW64 /c/xampp/htdocs/ecom
$ php artisan route:list
    ErrorException  : Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`

at C:\xampp\htdocs\ecom\vendor\themsaid\laravel-langman\src\Commands\FindCommand.php:113
109|             $original = [];
110|
111|             foreach ($allLanguages as $languageKey) {
112|                 $original[$languageKey] =
113|                     isset($values[$languageKey])
114|                         ? $values[$languageKey]
115|                         : isset($filesContent[$fileName][$languageKey][$key]) ? $filesContent[$fileName][$languageKey][$key] : '';
116|             }
117|
Exception trace:

1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`","C:\xampp\htdocs\ecom\vendor\themsaid\laravel-langman\src\Commands\FindCommand.php", ["C:\xampp\htdocs\ecom\vendor\composer/../themsaid/laravel-langman/src/Commands/FindCommand.php"])
  C:\xampp\htdocs\ecom\vendor\composer\ClassLoader.php:444
2   include()
  C:\xampp\htdocs\ecom\vendor\composer\ClassLoader.php:444

Please use the argument -v to see more details.


Solution 1:[1]

Actually you have used multiple shorthand conditions which will throw error for most of the php artisan command. Change your code in FindCommand file line no 111

From this :

foreach ($allLanguages as $languageKey) {
                 $original[$languageKey] =
                     isset($values[$languageKey])
                         ? $values[$languageKey]
                         : isset($filesContent[$fileName][$languageKey][$key]) ? $filesContent[$fileName][$languageKey][$key] : '';
}

To this:

foreach ($allLanguages as $languageKey) {
    $original[$languageKey] = (isset($values[$languageKey]) ? $values[$languageKey] : isset($filesContent[$fileName][$languageKey][$key])) ? $filesContent[$fileName][$languageKey][$key] : '';
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1