Skip to content

Commit 07181ac

Browse files
Merge branch '4.4'
* 4.4: some backports from master Add return types to internal|final|private methods [HttpFoundation] Precalculate session expiry timestamp
2 parents c33d7be + 9bf6aac commit 07181ac

12 files changed

+38
-57
lines changed

Data/Generator/AbstractDataGenerator.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,15 @@ public function generateData(GeneratorConfig $config)
9393
/**
9494
* @return string[]
9595
*/
96-
abstract protected function scanLocales(LocaleScanner $scanner, string $sourceDir);
96+
abstract protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array;
9797

9898
abstract protected function compileTemporaryBundles(BundleCompilerInterface $compiler, string $sourceDir, string $tempDir);
9999

100100
abstract protected function preGenerate();
101101

102-
/**
103-
* @return array|null
104-
*/
105-
abstract protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale);
102+
abstract protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array;
106103

107-
/**
108-
* @return array|null
109-
*/
110-
abstract protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir);
104+
abstract protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array;
111105

112-
/**
113-
* @return array|null
114-
*/
115-
abstract protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir);
106+
abstract protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array;
116107
}

Data/Generator/CurrencyDataGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
5151
/**
5252
* {@inheritdoc}
5353
*/
54-
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
54+
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
5555
{
5656
return $scanner->scanLocales($sourceDir.'/curr');
5757
}
@@ -76,7 +76,7 @@ protected function preGenerate()
7676
/**
7777
* {@inheritdoc}
7878
*/
79-
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
79+
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
8080
{
8181
$localeBundle = $reader->read($tempDir, $displayLocale);
8282

@@ -97,7 +97,7 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, str
9797
/**
9898
* {@inheritdoc}
9999
*/
100-
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
100+
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
101101
{
102102
$rootBundle = $reader->read($tempDir, 'root');
103103

@@ -110,7 +110,7 @@ protected function generateDataForRoot(BundleEntryReaderInterface $reader, strin
110110
/**
111111
* {@inheritdoc}
112112
*/
113-
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
113+
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
114114
{
115115
$rootBundle = $reader->read($tempDir, 'root');
116116
$supplementalDataBundle = $reader->read($tempDir, 'supplementalData');

Data/Generator/GeneratorConfig.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function addBundleWriter(string $targetDir, BundleWriterInterface $writer
4949
*
5050
* @return BundleWriterInterface[]
5151
*/
52-
public function getBundleWriters()
52+
public function getBundleWriters(): array
5353
{
5454
return $this->bundleWriters;
5555
}
@@ -60,7 +60,7 @@ public function getBundleWriters()
6060
*
6161
* @return string An absolute path to a directory
6262
*/
63-
public function getSourceDir()
63+
public function getSourceDir(): string
6464
{
6565
return $this->sourceDir;
6666
}
@@ -70,7 +70,7 @@ public function getSourceDir()
7070
*
7171
* @return string The ICU version string
7272
*/
73-
public function getIcuVersion()
73+
public function getIcuVersion(): string
7474
{
7575
return $this->icuVersion;
7676
}

Data/Generator/LanguageDataGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class LanguageDataGenerator extends AbstractDataGenerator
101101
/**
102102
* {@inheritdoc}
103103
*/
104-
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
104+
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
105105
{
106106
return $scanner->scanLocales($sourceDir.'/lang');
107107
}
@@ -126,7 +126,7 @@ protected function preGenerate()
126126
/**
127127
* {@inheritdoc}
128128
*/
129-
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
129+
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
130130
{
131131
$localeBundle = $reader->read($tempDir, $displayLocale);
132132

@@ -148,14 +148,14 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, str
148148
/**
149149
* {@inheritdoc}
150150
*/
151-
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
151+
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
152152
{
153153
}
154154

155155
/**
156156
* {@inheritdoc}
157157
*/
158-
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
158+
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
159159
{
160160
$rootBundle = $reader->read($tempDir, 'root');
161161
$metadataBundle = $reader->read($tempDir, 'metadata');

Data/Generator/LocaleDataGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class LocaleDataGenerator extends AbstractDataGenerator
3636
/**
3737
* {@inheritdoc}
3838
*/
39-
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
39+
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
4040
{
4141
$this->locales = $scanner->scanLocales($sourceDir.'/locales');
4242
$this->localeAliases = $scanner->scanAliases($sourceDir.'/locales');
@@ -74,7 +74,7 @@ protected function preGenerate()
7474
/**
7575
* {@inheritdoc}
7676
*/
77-
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
77+
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
7878
{
7979
// Don't generate aliases, as they are resolved during runtime
8080
// Unless an alias is needed as fallback for de-duplication purposes
@@ -133,14 +133,14 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, str
133133
/**
134134
* {@inheritdoc}
135135
*/
136-
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
136+
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
137137
{
138138
}
139139

140140
/**
141141
* {@inheritdoc}
142142
*/
143-
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
143+
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
144144
{
145145
return [
146146
'Locales' => $this->locales,

Data/Generator/RegionDataGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function isValidCountryCode($region)
8484
/**
8585
* {@inheritdoc}
8686
*/
87-
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
87+
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
8888
{
8989
return $scanner->scanLocales($sourceDir.'/region');
9090
}
@@ -109,7 +109,7 @@ protected function preGenerate()
109109
/**
110110
* {@inheritdoc}
111111
*/
112-
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
112+
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
113113
{
114114
$localeBundle = $reader->read($tempDir, $displayLocale);
115115

@@ -131,14 +131,14 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, str
131131
/**
132132
* {@inheritdoc}
133133
*/
134-
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
134+
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
135135
{
136136
}
137137

138138
/**
139139
* {@inheritdoc}
140140
*/
141-
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
141+
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
142142
{
143143
$rootBundle = $reader->read($tempDir, 'root');
144144
$metadataBundle = $reader->read($tempDir, 'metadata');

Data/Generator/ScriptDataGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ScriptDataGenerator extends AbstractDataGenerator
3838
/**
3939
* {@inheritdoc}
4040
*/
41-
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
41+
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
4242
{
4343
return $scanner->scanLocales($sourceDir.'/lang');
4444
}
@@ -62,7 +62,7 @@ protected function preGenerate()
6262
/**
6363
* {@inheritdoc}
6464
*/
65-
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
65+
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
6666
{
6767
$localeBundle = $reader->read($tempDir, $displayLocale);
6868

@@ -84,14 +84,14 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, str
8484
/**
8585
* {@inheritdoc}
8686
*/
87-
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
87+
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
8888
{
8989
}
9090

9191
/**
9292
* {@inheritdoc}
9393
*/
94-
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
94+
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
9595
{
9696
$rootBundle = $reader->read($tempDir, 'root');
9797

Data/Generator/TimezoneDataGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator
4242
/**
4343
* {@inheritdoc}
4444
*/
45-
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
45+
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
4646
{
4747
$this->localeAliases = $scanner->scanAliases($sourceDir.'/locales');
4848

@@ -75,7 +75,7 @@ protected function preGenerate()
7575
/**
7676
* {@inheritdoc}
7777
*/
78-
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
78+
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
7979
{
8080
if (!$this->zoneToCountryMapping) {
8181
$this->zoneToCountryMapping = self::generateZoneToCountryMapping($reader->read($tempDir, 'windowsZones'));
@@ -126,7 +126,7 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, str
126126
/**
127127
* {@inheritdoc}
128128
*/
129-
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
129+
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
130130
{
131131
$rootBundle = $reader->read($tempDir, 'root');
132132

@@ -139,7 +139,7 @@ protected function generateDataForRoot(BundleEntryReaderInterface $reader, strin
139139
/**
140140
* {@inheritdoc}
141141
*/
142-
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
142+
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
143143
{
144144
$rootBundle = $reader->read($tempDir, 'root');
145145

Data/Util/LocaleScanner.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ class LocaleScanner
3333
/**
3434
* Returns all locales found in the given directory.
3535
*
36-
* @param string $sourceDir The directory with ICU files
37-
*
3836
* @return array An array of locales. The result also contains locales that
3937
* are in fact just aliases for other locales. Use
4038
* {@link scanAliases()} to determine which of the locales
4139
* are aliases
4240
*/
43-
public function scanLocales(string $sourceDir)
41+
public function scanLocales(string $sourceDir): array
4442
{
4543
$locales = glob($sourceDir.'/*.txt');
4644

@@ -60,12 +58,10 @@ public function scanLocales(string $sourceDir)
6058
/**
6159
* Returns all locale aliases found in the given directory.
6260
*
63-
* @param string $sourceDir The directory with ICU files
64-
*
6561
* @return array An array with the locale aliases as keys and the aliased
6662
* locales as values
6763
*/
68-
public function scanAliases(string $sourceDir)
64+
public function scanAliases(string $sourceDir): array
6965
{
7066
$locales = $this->scanLocales($sourceDir);
7167
$aliases = [];

DateFormatter/DateFormat/FullTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function __construct(string $pattern, string $timezone)
7474
*
7575
* @return string The formatted value
7676
*/
77-
public function format(\DateTime $dateTime)
77+
public function format(\DateTime $dateTime): string
7878
{
7979
$formatted = preg_replace_callback($this->regExp, function ($matches) use ($dateTime) {
8080
return $this->formatReplace($matches[0], $dateTime);

0 commit comments

Comments
 (0)