package and depencies
This commit is contained in:
14
vendor/symfony/translation/Loader/FileLoader.php
vendored
14
vendor/symfony/translation/Loader/FileLoader.php
vendored
@@ -14,16 +14,14 @@ namespace Symfony\Component\Translation\Loader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
||||
*/
|
||||
abstract class FileLoader extends ArrayLoader
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($resource, string $locale, string $domain = 'messages')
|
||||
public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue
|
||||
{
|
||||
if (!stream_is_local($resource)) {
|
||||
throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource));
|
||||
@@ -36,9 +34,7 @@ abstract class FileLoader extends ArrayLoader
|
||||
$messages = $this->loadResource($resource);
|
||||
|
||||
// empty resource
|
||||
if (null === $messages) {
|
||||
$messages = [];
|
||||
}
|
||||
$messages ??= [];
|
||||
|
||||
// not an array
|
||||
if (!\is_array($messages)) {
|
||||
@@ -55,9 +51,7 @@ abstract class FileLoader extends ArrayLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
* @throws InvalidResourceException if stream content has an invalid format
|
||||
*/
|
||||
abstract protected function loadResource(string $resource);
|
||||
abstract protected function loadResource(string $resource): array;
|
||||
}
|
||||
|
Reference in New Issue
Block a user