[Translation] fix return type declarations

This commit is contained in:
Alexander M. Turek 2019-08-23 20:05:16 +02:00 committed by Nicolas Grekas
parent ca1fad471e
commit 70feaa407e
7 changed files with 16 additions and 12 deletions

View File

@ -107,6 +107,8 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @return int
*/ */
public function getPriority() public function getPriority()
{ {

View File

@ -97,6 +97,8 @@ class TranslationNodeVisitor extends AbstractNodeVisitor
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @return int
*/ */
public function getPriority() public function getPriority()
{ {

View File

@ -106,9 +106,7 @@ class TwigExtractor extends AbstractFileExtractor implements ExtractorInterface
} }
/** /**
* @param string|array $directory * {@inheritdoc}
*
* @return array
*/ */
protected function extractFromDirectory($directory) protected function extractFromDirectory($directory)
{ {

View File

@ -61,7 +61,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
} }
/** /**
* @return array * @return array|Data
*/ */
public function getMessages() public function getMessages()
{ {

View File

@ -21,9 +21,9 @@ use Symfony\Component\Translation\Exception\InvalidArgumentException;
abstract class AbstractFileExtractor abstract class AbstractFileExtractor
{ {
/** /**
* @param string|array $resource Files, a file or a directory * @param string|iterable $resource Files, a file or a directory
* *
* @return array * @return iterable
*/ */
protected function extractFiles($resource) protected function extractFiles($resource)
{ {
@ -79,7 +79,7 @@ abstract class AbstractFileExtractor
/** /**
* @param string|array $resource Files, a file or a directory * @param string|array $resource Files, a file or a directory
* *
* @return array files to be extracted * @return iterable files to be extracted
*/ */
abstract protected function extractFromDirectory($resource); abstract protected function extractFromDirectory($resource);
} }

View File

@ -103,7 +103,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface
* *
* @param mixed $token * @param mixed $token
* *
* @return string * @return string|null
*/ */
protected function normalizeToken($token) protected function normalizeToken($token)
{ {
@ -257,9 +257,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface
} }
/** /**
* @param string|array $directory * {@inheritdoc}
*
* @return array
*/ */
protected function extractFromDirectory($directory) protected function extractFromDirectory($directory)
{ {

View File

@ -52,6 +52,10 @@ class YamlFileLoader extends FileLoader
restore_error_handler(); restore_error_handler();
} }
return $messages; if (null !== $messages && !\is_array($messages)) {
throw new InvalidResourceException(sprintf('Unable to load file "%s".', $resource));
}
return $messages ?: [];
} }
} }