mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-26 04:39:09 -04:00
ALPHA 3.0.2a
This commit is contained in:
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Catalogue;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\MessageCatalogueInterface;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\MessageCatalogueInterface;
|
||||
|
||||
/**
|
||||
* Base catalogues binary operation class.
|
||||
@@ -91,7 +91,7 @@ abstract class AbstractOperation implements OperationInterface
|
||||
*/
|
||||
public function getMessages($domain)
|
||||
{
|
||||
if (!in_array($domain, $this->getDomains())) {
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ abstract class AbstractOperation implements OperationInterface
|
||||
*/
|
||||
public function getNewMessages($domain)
|
||||
{
|
||||
if (!in_array($domain, $this->getDomains())) {
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ abstract class AbstractOperation implements OperationInterface
|
||||
*/
|
||||
public function getObsoleteMessages($domain)
|
||||
{
|
||||
if (!in_array($domain, $this->getDomains())) {
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
}
|
||||
|
||||
|
||||
@@ -130,16 +130,16 @@ EOF
|
||||
$document->schemaValidate(__DIR__.'/../Resources/schemas/xliff-core-1.2-strict.xsd');
|
||||
foreach (libxml_get_errors() as $xmlError) {
|
||||
$errors[] = array(
|
||||
'line' => $xmlError->line,
|
||||
'column' => $xmlError->column,
|
||||
'message' => trim($xmlError->message),
|
||||
);
|
||||
'line' => $xmlError->line,
|
||||
'column' => $xmlError->column,
|
||||
'message' => trim($xmlError->message),
|
||||
);
|
||||
}
|
||||
|
||||
libxml_clear_errors();
|
||||
libxml_use_internal_errors(false);
|
||||
|
||||
return array('file' => $file, 'valid' => 0 === count($errors), 'messages' => $errors);
|
||||
return array('file' => $file, 'valid' => 0 === \count($errors), 'messages' => $errors);
|
||||
}
|
||||
|
||||
private function display(SymfonyStyle $io, array $files)
|
||||
@@ -156,7 +156,7 @@ EOF
|
||||
|
||||
private function displayTxt(SymfonyStyle $io, array $filesInfo)
|
||||
{
|
||||
$countFiles = count($filesInfo);
|
||||
$countFiles = \count($filesInfo);
|
||||
$erroredFiles = 0;
|
||||
|
||||
foreach ($filesInfo as $info) {
|
||||
@@ -206,7 +206,7 @@ EOF
|
||||
}
|
||||
|
||||
foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) {
|
||||
if (!in_array($file->getExtension(), array('xlf', 'xliff'))) {
|
||||
if (!\in_array($file->getExtension(), array('xlf', 'xliff'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ EOF
|
||||
};
|
||||
|
||||
if (null !== $this->directoryIteratorProvider) {
|
||||
return call_user_func($this->directoryIteratorProvider, $directory, $default);
|
||||
return \call_user_func($this->directoryIteratorProvider, $directory, $default);
|
||||
}
|
||||
|
||||
return $default($directory);
|
||||
@@ -251,7 +251,7 @@ EOF
|
||||
};
|
||||
|
||||
if (null !== $this->isReadableProvider) {
|
||||
return call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
|
||||
return \call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
|
||||
}
|
||||
|
||||
return $default($fileOrDirectory);
|
||||
|
||||
@@ -99,7 +99,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
||||
|
||||
public function getFallbackLocales()
|
||||
{
|
||||
return (isset($this->data['fallback_locales']) && count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : array();
|
||||
return (isset($this->data['fallback_locales']) && \count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : array();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,7 +158,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto
|
||||
if (mb_strlen($string, $encoding) > $length) {
|
||||
return mb_substr($string, 0, $length - 3, $encoding).'...';
|
||||
}
|
||||
} elseif (strlen($string) > $length) {
|
||||
} elseif (\strlen($string) > $length) {
|
||||
return substr($string, 0, $length - 3).'...';
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
{
|
||||
if (!$translator instanceof TranslatorBagInterface) {
|
||||
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator)));
|
||||
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', \get_class($translator)));
|
||||
}
|
||||
|
||||
$this->translator = $translator;
|
||||
@@ -106,7 +106,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
return call_user_func_array(array($this->translator, $method), $args);
|
||||
return \call_user_func_array(array($this->translator, $method), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\Translation\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Adds tagged translation.formatter services to translation writer.
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\Translation\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Adds tagged translation.extractor services to translation extractor.
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\Translation\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
class TranslatorPass implements CompilerPassInterface
|
||||
{
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Dumper;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\Exception\RuntimeException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* FileDumper is an implementation of DumperInterface that dump a message catalogue to file(s).
|
||||
@@ -51,7 +51,7 @@ abstract class FileDumper implements DumperInterface
|
||||
*/
|
||||
public function setBackup($backup)
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
if (false !== $backup) {
|
||||
throw new \LogicException('The backup feature is no longer supported.');
|
||||
@@ -71,7 +71,7 @@ abstract class FileDumper implements DumperInterface
|
||||
foreach ($messages->getDomains() as $domain) {
|
||||
$fullpath = $options['path'].'/'.$this->getRelativePath($domain, $messages->getLocale());
|
||||
if (!file_exists($fullpath)) {
|
||||
$directory = dirname($fullpath);
|
||||
$directory = \dirname($fullpath);
|
||||
if (!file_exists($directory) && !@mkdir($directory, 0777, true)) {
|
||||
throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory));
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class IcuResFileDumper extends FileDumper
|
||||
$data = $indexes = $resources = '';
|
||||
|
||||
foreach ($messages->all($domain) as $source => $target) {
|
||||
$indexes .= pack('v', strlen($data) + 28);
|
||||
$indexes .= pack('v', \strlen($data) + 28);
|
||||
$data .= $source."\0";
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class IcuResFileDumper extends FileDumper
|
||||
foreach ($messages->all($domain) as $source => $target) {
|
||||
$resources .= pack('V', $this->getPosition($data));
|
||||
|
||||
$data .= pack('V', strlen($target))
|
||||
$data .= pack('V', \strlen($target))
|
||||
.mb_convert_encoding($target."\0", 'UTF-16LE', 'UTF-8')
|
||||
.$this->writePadding($data)
|
||||
;
|
||||
@@ -52,7 +52,7 @@ class IcuResFileDumper extends FileDumper
|
||||
|
||||
$resOffset = $this->getPosition($data);
|
||||
|
||||
$data .= pack('v', count($messages->all($domain)))
|
||||
$data .= pack('v', \count($messages->all($domain)))
|
||||
.$indexes
|
||||
.$this->writePadding($data)
|
||||
.$resources
|
||||
@@ -66,7 +66,7 @@ class IcuResFileDumper extends FileDumper
|
||||
$keyTop, // Index keys top
|
||||
$bundleTop, // Index resources top
|
||||
$bundleTop, // Index bundle top
|
||||
count($messages->all($domain)), // Index max table length
|
||||
\count($messages->all($domain)), // Index max table length
|
||||
0 // Index attributes
|
||||
);
|
||||
|
||||
@@ -84,7 +84,7 @@ class IcuResFileDumper extends FileDumper
|
||||
|
||||
private function writePadding($data)
|
||||
{
|
||||
$padding = strlen($data) % 4;
|
||||
$padding = \strlen($data) % 4;
|
||||
|
||||
if ($padding) {
|
||||
return str_repeat("\xAA", 4 - $padding);
|
||||
@@ -93,7 +93,7 @@ class IcuResFileDumper extends FileDumper
|
||||
|
||||
private function getPosition($data)
|
||||
{
|
||||
return (strlen($data) + 28) / 4;
|
||||
return (\strlen($data) + 28) / 4;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Dumper;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Loader\MoFileLoader;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* MoFileDumper generates a gettext formatted string representation of a message catalogue.
|
||||
@@ -47,7 +47,7 @@ class MoFileDumper extends FileDumper
|
||||
'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size),
|
||||
);
|
||||
|
||||
$sourcesSize = strlen($sources);
|
||||
$sourcesSize = \strlen($sources);
|
||||
$sourcesStart = $header['offsetHashes'] + 1;
|
||||
|
||||
foreach ($offsets as $offset) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Dumper;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* XliffFileDumper generates xliff files from a message catalogue.
|
||||
@@ -147,7 +147,7 @@ class XliffFileDumper extends FileDumper
|
||||
$translation = $dom->createElement('unit');
|
||||
$translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._'));
|
||||
$name = $source;
|
||||
if (strlen($source) > 80) {
|
||||
if (\strlen($source) > 80) {
|
||||
$name = substr(md5($source), -7);
|
||||
}
|
||||
$translation->setAttribute('name', $name);
|
||||
@@ -200,6 +200,6 @@ class XliffFileDumper extends FileDumper
|
||||
*/
|
||||
private function hasMetadataArrayInfo($key, $metadata = null)
|
||||
{
|
||||
return null !== $metadata && array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || is_array($metadata[$key]));
|
||||
return null !== $metadata && array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || \is_array($metadata[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Dumper;
|
||||
|
||||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Util\ArrayConverter;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
|
||||
/**
|
||||
* YamlFileDumper generates yaml files from a message catalogue.
|
||||
|
||||
@@ -27,7 +27,7 @@ abstract class AbstractFileExtractor
|
||||
*/
|
||||
protected function extractFiles($resource)
|
||||
{
|
||||
if (is_array($resource) || $resource instanceof \Traversable) {
|
||||
if (\is_array($resource) || $resource instanceof \Traversable) {
|
||||
$files = array();
|
||||
foreach ($resource as $file) {
|
||||
if ($this->canBeExtracted($file)) {
|
||||
|
||||
@@ -208,7 +208,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface
|
||||
} elseif (self::MESSAGE_TOKEN === $item) {
|
||||
$message = $this->getValue($tokenIterator);
|
||||
|
||||
if (count($sequence) === ($sequenceKey + 1)) {
|
||||
if (\count($sequence) === ($sequenceKey + 1)) {
|
||||
break;
|
||||
}
|
||||
} elseif (self::METHOD_ARGUMENTS_TOKEN === $item) {
|
||||
|
||||
@@ -113,9 +113,9 @@ class PhpStringTokenParser
|
||||
if (isset(self::$replacements[$str])) {
|
||||
return self::$replacements[$str];
|
||||
} elseif ('x' === $str[0] || 'X' === $str[0]) {
|
||||
return chr(hexdec($str));
|
||||
return \chr(hexdec($str));
|
||||
} else {
|
||||
return chr(octdec($str));
|
||||
return \chr(octdec($str));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class ArrayLoader implements LoaderInterface
|
||||
$subnode = &$messages;
|
||||
}
|
||||
foreach ($subnode as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
if (\is_array($value)) {
|
||||
$nodePath = $path ? $path.'.'.$key : $key;
|
||||
$this->flatten($messages, $value, $nodePath);
|
||||
if (null === $path) {
|
||||
|
||||
@@ -41,7 +41,7 @@ class CsvFileLoader extends FileLoader
|
||||
$file->setCsvControl($this->delimiter, $this->enclosure, $this->escape);
|
||||
|
||||
foreach ($file as $data) {
|
||||
if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === count($data)) {
|
||||
if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) {
|
||||
$messages[$data[0]] = $data[1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
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\Config\Resource\FileResource;
|
||||
|
||||
/**
|
||||
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
|
||||
@@ -41,7 +41,7 @@ abstract class FileLoader extends ArrayLoader
|
||||
}
|
||||
|
||||
// not an array
|
||||
if (!is_array($messages)) {
|
||||
if (!\is_array($messages)) {
|
||||
throw new InvalidResourceException(sprintf('Unable to load file "%s".', $resource));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* IcuResFileLoader loads translations from a resource bundle.
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* IcuResFileLoader loads translations from a resource bundle.
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* LoaderInterface is the interface implemented by all translation loaders.
|
||||
|
||||
@@ -111,7 +111,7 @@ class MoFileLoader extends FileLoader
|
||||
$ids = array('singular' => $singularId, 'plural' => $pluralId);
|
||||
$item = compact('ids', 'translated');
|
||||
|
||||
if (is_array($item['translated'])) {
|
||||
if (\is_array($item['translated'])) {
|
||||
$messages[$item['ids']['singular']] = stripcslashes($item['translated'][0]);
|
||||
if (isset($item['ids']['plural'])) {
|
||||
$plurals = array();
|
||||
|
||||
@@ -78,7 +78,7 @@ class PoFileLoader extends FileLoader
|
||||
|
||||
if ('' === $line) {
|
||||
// Whitespace indicated current item is done
|
||||
if (!in_array('fuzzy', $flags)) {
|
||||
if (!\in_array('fuzzy', $flags)) {
|
||||
$this->addMessage($messages, $item);
|
||||
}
|
||||
$item = $defaults;
|
||||
@@ -96,7 +96,7 @@ class PoFileLoader extends FileLoader
|
||||
} elseif ('"' === $line[0]) {
|
||||
$continues = isset($item['translated']) ? 'translated' : 'ids';
|
||||
|
||||
if (is_array($item[$continues])) {
|
||||
if (\is_array($item[$continues])) {
|
||||
end($item[$continues]);
|
||||
$item[$continues][key($item[$continues])] .= substr($line, 1, -1);
|
||||
} else {
|
||||
@@ -110,7 +110,7 @@ class PoFileLoader extends FileLoader
|
||||
}
|
||||
}
|
||||
// save last item
|
||||
if (!in_array('fuzzy', $flags)) {
|
||||
if (!\in_array('fuzzy', $flags)) {
|
||||
$this->addMessage($messages, $item);
|
||||
}
|
||||
fclose($stream);
|
||||
@@ -126,7 +126,7 @@ class PoFileLoader extends FileLoader
|
||||
*/
|
||||
private function addMessage(array &$messages, array $item)
|
||||
{
|
||||
if (is_array($item['translated'])) {
|
||||
if (\is_array($item['translated'])) {
|
||||
$messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated'][0]);
|
||||
if (isset($item['ids']['plural'])) {
|
||||
$plurals = $item['translated'];
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Config\Util\XmlUtils;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* QtFileLoader loads translations from QT Translations XML files.
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Config\Util\XmlUtils;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* XliffFileLoader loads translations from XLIFF files.
|
||||
@@ -228,7 +228,7 @@ class XliffFileLoader implements LoaderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
||||
$drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
||||
$newPath = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));
|
||||
|
||||
return str_replace($xmlUri, $newPath, $schemaSource);
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace Symfony\Component\Translation\Loader;
|
||||
|
||||
use Symfony\Component\Translation\Exception\InvalidResourceException;
|
||||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
use Symfony\Component\Yaml\Parser as YamlParser;
|
||||
use Symfony\Component\Yaml\Exception\ParseException;
|
||||
use Symfony\Component\Yaml\Parser as YamlParser;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,7 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface
|
||||
public function __construct(TranslatorInterface $translator, LoggerInterface $logger)
|
||||
{
|
||||
if (!$translator instanceof TranslatorBagInterface) {
|
||||
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator)));
|
||||
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', \get_class($translator)));
|
||||
}
|
||||
|
||||
$this->translator = $translator;
|
||||
@@ -105,7 +105,7 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
return call_user_func_array(array($this->translator, $method), $args);
|
||||
return \call_user_func_array(array($this->translator, $method), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,7 +82,7 @@ class MessageSelector
|
||||
if (!isset($standardRules[$position])) {
|
||||
// when there's exactly one rule given, and that rule is a standard
|
||||
// rule, use this rule
|
||||
if (1 === count($parts) && isset($standardRules[0])) {
|
||||
if (1 === \count($parts) && isset($standardRules[0])) {
|
||||
return $standardRules[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -35,14 +35,14 @@ class PluralizationRules
|
||||
$locale = 'xbr';
|
||||
}
|
||||
|
||||
if (strlen($locale) > 3) {
|
||||
$locale = substr($locale, 0, -strlen(strrchr($locale, '_')));
|
||||
if (\strlen($locale) > 3) {
|
||||
$locale = substr($locale, 0, -\strlen(strrchr($locale, '_')));
|
||||
}
|
||||
|
||||
if (isset(self::$rules[$locale])) {
|
||||
$return = call_user_func(self::$rules[$locale], $number);
|
||||
$return = \call_user_func(self::$rules[$locale], $number);
|
||||
|
||||
if (!is_int($return) || $return < 0) {
|
||||
if (!\is_int($return) || $return < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -144,6 +144,7 @@ class PluralizationRules
|
||||
case 'bs':
|
||||
case 'hr':
|
||||
case 'ru':
|
||||
case 'sh':
|
||||
case 'sr':
|
||||
case 'uk':
|
||||
return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
|
||||
@@ -200,8 +201,8 @@ class PluralizationRules
|
||||
$locale = 'xbr';
|
||||
}
|
||||
|
||||
if (strlen($locale) > 3) {
|
||||
$locale = substr($locale, 0, -strlen(strrchr($locale, '_')));
|
||||
if (\strlen($locale) > 3) {
|
||||
$locale = substr($locale, 0, -\strlen(strrchr($locale, '_')));
|
||||
}
|
||||
|
||||
self::$rules[$locale] = $rule;
|
||||
|
||||
@@ -55,7 +55,7 @@ class TranslationReader implements TranslationReaderInterface
|
||||
$extension = $catalogue->getLocale().'.'.$format;
|
||||
$files = $finder->files()->name('*.'.$extension)->in($directory);
|
||||
foreach ($files as $file) {
|
||||
$domain = substr($file->getFilename(), 0, -1 * strlen($extension) - 1);
|
||||
$domain = substr($file->getFilename(), 0, -1 * \strlen($extension) - 1);
|
||||
$catalogue->addCatalogue($loader->load($file->getPathname(), $catalogue->getLocale(), $domain));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ Jan-10-2006
|
||||
-->
|
||||
<xsd:schema xmlns:xlf="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:oasis:names:tc:xliff:document:1.2" xml:lang="en">
|
||||
<!-- Import for xml:lang and xml:space -->
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="../../Loader/schema/dic/xliff-core/xml.xsd"/>
|
||||
<!-- Attributes Lists -->
|
||||
<xsd:simpleType name="XTend">
|
||||
<xsd:restriction base="xsd:string">
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\DataCollector;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\DataCollectorTranslator;
|
||||
use Symfony\Component\Translation\DataCollector\TranslationDataCollector;
|
||||
use Symfony\Component\Translation\DataCollectorTranslator;
|
||||
|
||||
class TranslationDataCollectorTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
namespace Symfony\Component\Translation\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
use Symfony\Component\Translation\DataCollectorTranslator;
|
||||
use Symfony\Component\Translation\Loader\ArrayLoader;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
|
||||
class DataCollectorTranslatorTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -35,8 +35,8 @@ class TranslationDumperPassTest extends TestCase
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$definitionsBefore = count($container->getDefinitions());
|
||||
$aliasesBefore = count($container->getAliases());
|
||||
$definitionsBefore = \count($container->getDefinitions());
|
||||
$aliasesBefore = \count($container->getAliases());
|
||||
|
||||
$translationDumperPass = new TranslationDumperPass();
|
||||
$translationDumperPass->process($container);
|
||||
|
||||
@@ -35,8 +35,8 @@ class TranslationExtractorPassTest extends TestCase
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$definitionsBefore = count($container->getDefinitions());
|
||||
$aliasesBefore = count($container->getAliases());
|
||||
$definitionsBefore = \count($container->getDefinitions());
|
||||
$aliasesBefore = \count($container->getAliases());
|
||||
|
||||
$translationDumperPass = new TranslationExtractorPass();
|
||||
$translationDumperPass->process($container);
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\CsvFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class CsvFileDumperTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\FileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class FileDumperTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\IcuResFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class IcuResFileDumperTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\IniFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class IniFileDumperTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\JsonFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class JsonFileDumperTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\MoFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class MoFileDumperTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\PhpFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class PhpFileDumperTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\PoFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class PoFileDumperTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\QtFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class QtFileDumperTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\XliffFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class XliffFileDumperTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\YamlFileDumper;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
class YamlFileDumperTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\CsvFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\CsvFileLoader;
|
||||
|
||||
class CsvFileLoaderTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use Symfony\Component\Translation\Loader\IcuDatFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\IcuDatFileLoader;
|
||||
|
||||
/**
|
||||
* @requires extension intl
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use Symfony\Component\Translation\Loader\IcuResFileLoader;
|
||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
||||
use Symfony\Component\Translation\Loader\IcuResFileLoader;
|
||||
|
||||
/**
|
||||
* @requires extension intl
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\IniFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\IniFileLoader;
|
||||
|
||||
class IniFileLoaderTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\JsonFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\JsonFileLoader;
|
||||
|
||||
class JsonFileLoaderTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ abstract class LocalizedTestCase extends TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
if (!extension_loaded('intl')) {
|
||||
if (!\extension_loaded('intl')) {
|
||||
$this->markTestSkipped('Extension intl is required.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\MoFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\MoFileLoader;
|
||||
|
||||
class MoFileLoaderTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\PhpFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\PhpFileLoader;
|
||||
|
||||
class PhpFileLoaderTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\PoFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\PoFileLoader;
|
||||
|
||||
class PoFileLoaderTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\QtFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\QtFileLoader;
|
||||
|
||||
class QtFileLoaderTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\XliffFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\XliffFileLoader;
|
||||
|
||||
class XliffFileLoaderTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Translation\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Loader\YamlFileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Translation\Loader\YamlFileLoader;
|
||||
|
||||
class YamlFileLoaderTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
namespace Symfony\Component\Translation\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
use Symfony\Component\Translation\LoggingTranslator;
|
||||
use Symfony\Component\Translation\Loader\ArrayLoader;
|
||||
use Symfony\Component\Translation\LoggingTranslator;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
|
||||
class LoggingTranslatorTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -100,9 +100,9 @@ class PluralizationRulesTest extends TestCase
|
||||
foreach ($matrix as $langCode => $data) {
|
||||
$indexes = array_flip($data);
|
||||
if ($expectSuccess) {
|
||||
$this->assertEquals($nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
|
||||
$this->assertEquals($nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
|
||||
} else {
|
||||
$this->assertNotEquals((int) $nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
|
||||
$this->assertNotEquals((int) $nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
|
||||
use Symfony\Component\Translation\Loader\ArrayLoader;
|
||||
use Symfony\Component\Translation\Loader\LoaderInterface;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
|
||||
class TranslatorCacheTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
namespace Symfony\Component\Translation\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
use Symfony\Component\Translation\Loader\ArrayLoader;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
|
||||
class TranslatorTest extends TestCase
|
||||
{
|
||||
@@ -297,12 +297,12 @@ class TranslatorTest extends TestCase
|
||||
|
||||
$resources = $translator->getCatalogue('en')->getResources();
|
||||
$this->assertCount(1, $resources);
|
||||
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
|
||||
$resources = $translator->getCatalogue('en_GB')->getResources();
|
||||
$this->assertCount(2, $resources);
|
||||
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'empty.yml', $resources);
|
||||
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'empty.yml', $resources);
|
||||
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
18
vendor/symfony/translation/Translator.php
vendored
18
vendor/symfony/translation/Translator.php
vendored
@@ -11,17 +11,17 @@
|
||||
|
||||
namespace Symfony\Component\Translation;
|
||||
|
||||
use Symfony\Component\Translation\Loader\LoaderInterface;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Config\ConfigCacheFactory;
|
||||
use Symfony\Component\Config\ConfigCacheFactoryInterface;
|
||||
use Symfony\Component\Config\ConfigCacheInterface;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
use Symfony\Component\Translation\Exception\NotFoundResourceException;
|
||||
use Symfony\Component\Translation\Exception\RuntimeException;
|
||||
use Symfony\Component\Config\ConfigCacheInterface;
|
||||
use Symfony\Component\Config\ConfigCacheFactoryInterface;
|
||||
use Symfony\Component\Config\ConfigCacheFactory;
|
||||
use Symfony\Component\Translation\Formatter\MessageFormatterInterface;
|
||||
use Symfony\Component\Translation\Formatter\ChoiceMessageFormatterInterface;
|
||||
use Symfony\Component\Translation\Formatter\MessageFormatter;
|
||||
use Symfony\Component\Translation\Formatter\MessageFormatterInterface;
|
||||
use Symfony\Component\Translation\Loader\LoaderInterface;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
@@ -125,7 +125,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface
|
||||
|
||||
$this->resources[$locale][] = array($format, $resource, $domain);
|
||||
|
||||
if (in_array($locale, $this->fallbackLocales)) {
|
||||
if (\in_array($locale, $this->fallbackLocales)) {
|
||||
$this->catalogues = array();
|
||||
} else {
|
||||
unset($this->catalogues[$locale]);
|
||||
@@ -196,7 +196,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface
|
||||
public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
|
||||
{
|
||||
if (!$this->formatter instanceof ChoiceMessageFormatterInterface) {
|
||||
throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', get_class($this->formatter)));
|
||||
throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', \get_class($this->formatter)));
|
||||
}
|
||||
|
||||
if (null === $domain) {
|
||||
@@ -402,7 +402,7 @@ EOF
|
||||
}
|
||||
|
||||
if (false !== strrchr($locale, '_')) {
|
||||
array_unshift($locales, substr($locale, 0, -strlen(strrchr($locale, '_'))));
|
||||
array_unshift($locales, substr($locale, 0, -\strlen(strrchr($locale, '_'))));
|
||||
}
|
||||
|
||||
return array_unique($locales);
|
||||
|
||||
@@ -54,7 +54,7 @@ class ArrayConverter
|
||||
$parentOfElem = null;
|
||||
|
||||
foreach ($parts as $i => $part) {
|
||||
if (isset($elem[$part]) && is_string($elem[$part])) {
|
||||
if (isset($elem[$part]) && \is_string($elem[$part])) {
|
||||
/* Process next case:
|
||||
* 'foo': 'test1',
|
||||
* 'foo.bar': 'test2'
|
||||
@@ -62,14 +62,14 @@ class ArrayConverter
|
||||
* $tree['foo'] was string before we found array {bar: test2}.
|
||||
* Treat new element as string too, e.g. add $tree['foo.bar'] = 'test2';
|
||||
*/
|
||||
$elem = &$elem[implode('.', array_slice($parts, $i))];
|
||||
$elem = &$elem[implode('.', \array_slice($parts, $i))];
|
||||
break;
|
||||
}
|
||||
$parentOfElem = &$elem;
|
||||
$elem = &$elem[$part];
|
||||
}
|
||||
|
||||
if (is_array($elem) && count($elem) > 0 && $parentOfElem) {
|
||||
if (\is_array($elem) && \count($elem) > 0 && $parentOfElem) {
|
||||
/* Process next case:
|
||||
* 'foo.bar': 'test1'
|
||||
* 'foo': 'test2'
|
||||
@@ -89,7 +89,7 @@ class ArrayConverter
|
||||
$prefix .= '.';
|
||||
|
||||
foreach ($node as $id => $value) {
|
||||
if (is_string($value)) {
|
||||
if (\is_string($value)) {
|
||||
$tree[$prefix.$id] = $value;
|
||||
} else {
|
||||
self::cancelExpand($tree, $prefix.$id, $value);
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Writer;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\Dumper\DumperInterface;
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\Exception\RuntimeException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
|
||||
/**
|
||||
* TranslationWriter writes translation messages.
|
||||
@@ -43,7 +43,7 @@ class TranslationWriter implements TranslationWriterInterface
|
||||
*/
|
||||
public function disableBackup()
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
foreach ($this->dumpers as $dumper) {
|
||||
if (method_exists($dumper, 'setBackup')) {
|
||||
|
||||
Reference in New Issue
Block a user