package and depencies

This commit is contained in:
RafficMohammed
2023-01-08 02:57:24 +05:30
parent d5332eb421
commit 1d54b8bc7f
4309 changed files with 193331 additions and 172289 deletions

View File

@@ -20,10 +20,7 @@ use Symfony\Component\Translation\Exception\InvalidResourceException;
*/
class JsonFileLoader extends FileLoader
{
/**
* {@inheritdoc}
*/
protected function loadResource(string $resource)
protected function loadResource(string $resource): array
{
$messages = [];
if ($data = file_get_contents($resource)) {
@@ -42,19 +39,13 @@ class JsonFileLoader extends FileLoader
*/
private function getJSONErrorMessage(int $errorCode): string
{
switch ($errorCode) {
case \JSON_ERROR_DEPTH:
return 'Maximum stack depth exceeded';
case \JSON_ERROR_STATE_MISMATCH:
return 'Underflow or the modes mismatch';
case \JSON_ERROR_CTRL_CHAR:
return 'Unexpected control character found';
case \JSON_ERROR_SYNTAX:
return 'Syntax error, malformed JSON';
case \JSON_ERROR_UTF8:
return 'Malformed UTF-8 characters, possibly incorrectly encoded';
default:
return 'Unknown error';
}
return match ($errorCode) {
\JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
\JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch',
\JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
\JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
\JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded',
default => 'Unknown error',
};
}
}