Skip to content

Commit 9e4b8be

Browse files
Add return types to tests and final|internal|private methods
1 parent ffde7c5 commit 9e4b8be

16 files changed

+36
-73
lines changed

Intl.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ final class Intl
109109
*
110110
* @return bool Returns true if the intl extension is installed, false otherwise
111111
*/
112-
public static function isExtensionLoaded()
112+
public static function isExtensionLoaded(): bool
113113
{
114114
return class_exists('\ResourceBundle');
115115
}
@@ -121,7 +121,7 @@ public static function isExtensionLoaded()
121121
*
122122
* @deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Currencies} instead.
123123
*/
124-
public static function getCurrencyBundle()
124+
public static function getCurrencyBundle(): CurrencyBundleInterface
125125
{
126126
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Currencies::class), E_USER_DEPRECATED);
127127

@@ -143,7 +143,7 @@ public static function getCurrencyBundle()
143143
*
144144
* @deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Languages} or {@see Scripts} instead.
145145
*/
146-
public static function getLanguageBundle()
146+
public static function getLanguageBundle(): LanguageBundleInterface
147147
{
148148
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" or "%s" instead.', __METHOD__, Languages::class, Scripts::class), E_USER_DEPRECATED);
149149

@@ -169,7 +169,7 @@ public static function getLanguageBundle()
169169
*
170170
* @deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Locales} instead.
171171
*/
172-
public static function getLocaleBundle()
172+
public static function getLocaleBundle(): LocaleBundleInterface
173173
{
174174
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Locales::class), E_USER_DEPRECATED);
175175

@@ -190,7 +190,7 @@ public static function getLocaleBundle()
190190
*
191191
* @deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Countries} instead.
192192
*/
193-
public static function getRegionBundle()
193+
public static function getRegionBundle(): RegionBundleInterface
194194
{
195195
@trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Countries::class), E_USER_DEPRECATED);
196196

@@ -210,7 +210,7 @@ public static function getRegionBundle()
210210
*
211211
* @return string|null The ICU version or NULL if it could not be determined
212212
*/
213-
public static function getIcuVersion()
213+
public static function getIcuVersion(): ?string
214214
{
215215
if (false === self::$icuVersion) {
216216
if (!self::isExtensionLoaded()) {
@@ -240,7 +240,7 @@ public static function getIcuVersion()
240240
*
241241
* @return string The version of the installed ICU data
242242
*/
243-
public static function getIcuDataVersion()
243+
public static function getIcuDataVersion(): string
244244
{
245245
if (false === self::$icuDataVersion) {
246246
self::$icuDataVersion = trim(file_get_contents(self::getDataDirectory().'/version.txt'));
@@ -254,7 +254,7 @@ public static function getIcuDataVersion()
254254
*
255255
* @return string The ICU version of the stub classes
256256
*/
257-
public static function getIcuStubVersion()
257+
public static function getIcuStubVersion(): string
258258
{
259259
return '64.2';
260260
}
@@ -264,7 +264,7 @@ public static function getIcuStubVersion()
264264
*
265265
* @return string The absolute path to the data directory
266266
*/
267-
public static function getDataDirectory()
267+
public static function getDataDirectory(): string
268268
{
269269
return __DIR__.'/Resources/data';
270270
}

Tests/Collator/AbstractCollatorTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ public function asortProvider()
5454
}
5555

5656
/**
57-
* @param string $locale
58-
*
59-
* @return \Collator
57+
* @return Collator|\Collator
6058
*/
61-
abstract protected function getCollator($locale);
59+
abstract protected function getCollator(string $locale);
6260
}

Tests/Collator/CollatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function testStaticCreate()
9595
$this->assertInstanceOf('\Symfony\Component\Intl\Collator\Collator', $collator);
9696
}
9797

98-
protected function getCollator($locale)
98+
protected function getCollator(?string $locale): Collator
9999
{
100100
return new class($locale) extends Collator {
101101
};

Tests/Collator/Verification/CollatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected function setUp(): void
2929
parent::setUp();
3030
}
3131

32-
protected function getCollator($locale)
32+
protected function getCollator(?string $locale): \Collator
3333
{
3434
return new \Collator($locale);
3535
}

Tests/Data/Provider/AbstractDataProviderTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -756,19 +756,13 @@ protected function getRootLocales()
756756
return self::$rootLocales;
757757
}
758758

759-
/**
760-
* @return BundleEntryReader
761-
*/
762-
protected function createEntryReader()
759+
protected function createEntryReader(): BundleEntryReader
763760
{
764761
$entryReader = new BundleEntryReader($this->createBundleReader());
765762
$entryReader->setLocaleAliases($this->getLocaleAliases());
766763

767764
return $entryReader;
768765
}
769766

770-
/**
771-
* @return BundleReaderInterface
772-
*/
773-
abstract protected function createBundleReader();
767+
abstract protected function createBundleReader(): BundleReaderInterface;
774768
}

Tests/Data/Provider/Json/JsonCurrencyDataProviderTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ protected function getDataDirectory()
2828
return Intl::getDataDirectory();
2929
}
3030

31-
/**
32-
* @return BundleReaderInterface
33-
*/
34-
protected function createBundleReader()
31+
protected function createBundleReader(): BundleReaderInterface
3532
{
3633
return new JsonBundleReader();
3734
}

Tests/Data/Provider/Json/JsonLanguageDataProviderTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ protected function getDataDirectory()
2828
return Intl::getDataDirectory();
2929
}
3030

31-
/**
32-
* @return BundleReaderInterface
33-
*/
34-
protected function createBundleReader()
31+
protected function createBundleReader(): BundleReaderInterface
3532
{
3633
return new JsonBundleReader();
3734
}

Tests/Data/Provider/Json/JsonLocaleDataProviderTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ protected function getDataDirectory()
2828
return Intl::getDataDirectory();
2929
}
3030

31-
/**
32-
* @return BundleReaderInterface
33-
*/
34-
protected function createBundleReader()
31+
protected function createBundleReader(): BundleReaderInterface
3532
{
3633
return new JsonBundleReader();
3734
}

Tests/Data/Provider/Json/JsonRegionDataProviderTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ protected function getDataDirectory()
2828
return Intl::getDataDirectory();
2929
}
3030

31-
/**
32-
* @return BundleReaderInterface
33-
*/
34-
protected function createBundleReader()
31+
protected function createBundleReader(): BundleReaderInterface
3532
{
3633
return new JsonBundleReader();
3734
}

Tests/Data/Provider/Json/JsonScriptDataProviderTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ protected function getDataDirectory()
2828
return Intl::getDataDirectory();
2929
}
3030

31-
/**
32-
* @return BundleReaderInterface
33-
*/
34-
protected function createBundleReader()
31+
protected function createBundleReader(): BundleReaderInterface
3532
{
3633
return new JsonBundleReader();
3734
}

0 commit comments

Comments
 (0)