Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -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.
@@ -24,20 +24,20 @@ class MoFileDumper extends FileDumper
/**
* {@inheritdoc}
*/
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string
{
$sources = $targets = $sourceOffsets = $targetOffsets = '';
$offsets = array();
$offsets = [];
$size = 0;
foreach ($messages->all($domain) as $source => $target) {
$offsets[] = array_map('strlen', array($sources, $source, $targets, $target));
$offsets[] = array_map('strlen', [$sources, $source, $targets, $target]);
$sources .= "\0".$source;
$targets .= "\0".$target;
++$size;
}
$header = array(
$header = [
'magicNumber' => MoFileLoader::MO_LITTLE_ENDIAN_MAGIC,
'formatRevision' => 0,
'count' => $size,
@@ -45,9 +45,9 @@ class MoFileDumper extends FileDumper
'offsetTranslated' => MoFileLoader::MO_HEADER_SIZE + (8 * $size),
'sizeHashes' => 0,
'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size),
);
];
$sourcesSize = strlen($sources);
$sourcesSize = \strlen($sources);
$sourcesStart = $header['offsetHashes'] + 1;
foreach ($offsets as $offset) {
@@ -57,12 +57,12 @@ class MoFileDumper extends FileDumper
.$this->writeLong($offset[2] + $sourcesStart + $sourcesSize);
}
$output = implode(array_map(array($this, 'writeLong'), $header))
$output = implode('', array_map([$this, 'writeLong'], $header))
.$sourceOffsets
.$targetOffsets
.$sources
.$targets
;
;
return $output;
}
@@ -70,12 +70,12 @@ class MoFileDumper extends FileDumper
/**
* {@inheritdoc}
*/
protected function getExtension()
protected function getExtension(): string
{
return 'mo';
}
private function writeLong($str)
private function writeLong(mixed $str): string
{
return pack('V*', $str);
}