8000 [Translation] Add types to constructors and private/final/internal me… · symfony/symfony@19c1ed9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 19c1ed9

Browse files
committed
[Translation] Add types to constructors and private/final/internal methods.
1 parent 7dd56ff commit 19c1ed9

File tree

9 files changed

+10
-12
lines changed

9 files changed

+10
-12
lines changed

src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ protected function initializeCatalogue($locale)
126126
/**
127127
* @internal
128128
*/
129-
protected function doLoadCatalogue($locale): void
129+
protected function doLoadCatalogue(string $locale): void
130130
{
131131
parent::doLoadCatalogue($locale);
132132

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"symfony/security-http": "^3.4|^4.0|^5.0",
5151
"symfony/serializer": "^4.3|^5.0",
5252
"symfony/stopwatch": "^3.4|^4.0|^5.0",
53-
"symfony/translation": "^4.3|^5.0",
53+
"symfony/translation": "^4.4|^5.0",
5454
"symfony/templating": "^3.4|^4.0|^5.0",
5555
"symfony/twig-bundle": "^4.4|^5.0",
5656
"symfony/validator": "^4.4|^5.0",
@@ -80,7 +80,7 @@
8080
"symfony/property-info": "<3.4",
8181
"symfony/serializer": "<4.2",
8282
"symfony/stopwatch": "<3.4",
83-
"symfony/translation": "<4.3",
83+
"symfony/translation": "<4.4",
8484
"symfony/twig-bridge": "<4.1.1",
8585
"symfony/twig-bundle": "<4.4",
8686
"symfony/validator": "<4.4",

src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
8282
return $header.$root.$data;
8383
}
8484

85-
private function writePadding(string $data)
85+
private function writePadding(string $data): ?string
8686
{
8787
$padding = \strlen($data) % 4;
8888

src/Symfony/Component/Translation/Dumper/MoFileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function getExtension()
7575
return 'mo';
7676
}
7777

78-
private function writeLong($str)
78+
8000 private function writeLong($str): string
7979
{
8080
return pack('V*', $str);
8181
}

src/Symfony/Component/Translation/Dumper/PoFileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ protected function getExtension()
119119
return 'po';
120120
}
121121

122-
private function escape(string $str)
122+
private function escape(string $str): string
123123
{
124124
return addcslashes($str, "\0..\37\42\134");
125125
}

src/Symfony/Component/Translation/Extractor/PhpStringTokenParser.php

Expand all lines: src/Symfony/Component/Translation/Extractor/PhpStringTokenParser.php
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public static function parseEscapeSequences($str, $quote)
106106
);
107107
}
108108

109-
private static function parseCallback($matches)
109+
private static function parseCallback(array $matches): string
110110
{
111111
$str = $matches[1];
112112

src/Symfony/Component/Translation/Interval.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static function getIntervalRegexp()
9999
EOF;
100100
}
101101

102-
private static function convertNumber($number)
102+
private static function convertNumber(string $number): float
103103
{
104104
if ('-Inf' === $number) {
105105
return log(0);

src/Symfony/Component/Translation/Loader/XliffFileLoader.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ private function extract($resource, MessageCatalogue $catalogue, string $domain)
7272

7373
/**
7474
* Extract messages and metadata from DOMDocument into a MessageCatalogue.
75-
*
76-
* @param string $domain The domain
7775
*/
7876
private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain)
7977
{

src/Symfony/Component/Translation/Translator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,15 +410,15 @@ private function getFallbackContent(MessageCatalogue $catalogue): string
410410
return $fallbackContent;
411411
}
412412

413-
private function getCatalogueCachePath(string $locale)
413+
private function getCatalogueCachePath(string $locale): string
414414
{
415415
return $this->cacheDir.'/catalogue.'.$locale.'.'.strtr(substr(base64_encode(hash('sha256', serialize($this->fallbackLocales), true)), 0, 7), '/', '_').'.php';
416416
}
417417

418418
/**
419419
* @internal
420420
*/
421-
protected function doLoadCatalogue($locale): void
421+
protected function doLoadCatalogue(string $locale): void
422422
{
423423
$this->catalogues[$locale] = new MessageCatalogue($locale);
424424

0 commit comments

Comments
 (0)
0