Skip to content

Commit 78abebc

Browse files
Merge branch '4.4'
* 4.4: Fixed tests on the Security and Form components Add return types to tests and final|internal|private methods
2 parents 73b83c4 + 9e4b8be commit 78abebc

File tree

9 files changed

+20
-36
lines changed

9 files changed

+20
-36
lines changed

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/DateFormatter/AbstractIntlDateFormatterTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -965,10 +965,7 @@ protected function assertIsIntlSuccess($formatter, $errorMessage, $errorCode)
965965
*/
966966
abstract protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null);
967967

968-
/**
969-
* @return string
970-
*/
971-
abstract protected function getIntlErrorMessage();
968+
abstract protected function getIntlErrorMessage(): string;
972969

973970
/**
974971
* @return int
@@ -977,8 +974,6 @@ abstract protected function getIntlErrorCode();
977974

978975
/**
979976
* @param int $errorCode
980-
*
981-
* @return bool
982977
*/
983-
abstract protected function isIntlFailure($errorCode);
978+
abstract protected function isIntlFailure($errorCode): bool;
984979
}

Tests/DateFormatter/IntlDateFormatterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ protected function getDateFormatter($locale, $datetype, $timetype, $timezone = n
183183
};
184184
}
185185

186-
protected function getIntlErrorMessage()
186+
protected function getIntlErrorMessage(): string
187187
{
188188
return IntlGlobals::getErrorMessage();
189189
}
@@ -193,7 +193,7 @@ protected function getIntlErrorCode()
193193
return IntlGlobals::getErrorCode();
194194
}
195195

196-
protected function isIntlFailure($errorCode)
196+
protected function isIntlFailure($errorCode): bool
197197
{
198198
return IntlGlobals::isFailure($errorCode);
199199
}

Tests/DateFormatter/Verification/IntlDateFormatterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function getDateFormatter($locale, $datetype, $timetype, $timezone = n
6868
return $formatter;
6969
}
7070

71-
protected function getIntlErrorMessage()
71+
protected function getIntlErrorMessage(): string
7272
{
7373
return intl_get_error_message();
7474
}
@@ -78,7 +78,7 @@ protected function getIntlErrorCode()
7878
return intl_get_error_code();
7979
}
8080

81-
protected function isIntlFailure($errorCode)
81+
protected function isIntlFailure($errorCode): bool
8282
{
8383
return intl_is_failure($errorCode);
8484
}

Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -834,18 +834,11 @@ public function testParseWithNotNullPositionValue()
834834
}
835835

836836
/**
837-
* @param string $locale
838-
* @param null $style
839-
* @param null $pattern
840-
*
841-
* @return \NumberFormatter
837+
* @return NumberFormatter|\NumberFormatter
842838
*/
843-
abstract protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null);
839+
abstract protected function getNumberFormatter(string $locale = 'en', string $style = null, string $pattern = null);
844840

845-
/**
846-
* @return string
847-
*/
848-
abstract protected function getIntlErrorMessage();
841+
abstract protected function getIntlErrorMessage(): string;
849842

850843
/**
851844
* @return int
@@ -854,8 +847,6 @@ abstract protected function getIntlErrorCode();
854847

855848
/**
856849
* @param int $errorCode
857-
*
858-
* @return bool
859850
*/
860-
abstract protected function isIntlFailure($errorCode);
851+
abstract protected function isIntlFailure($errorCode): bool;
861852
}

Tests/NumberFormatter/NumberFormatterTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ public function testSetTextAttribute()
168168
$formatter->setTextAttribute(NumberFormatter::NEGATIVE_PREFIX, '-');
169169
}
170170

171-
protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null)
171+
protected function getNumberFormatter(?string $locale = 'en', string $style = null, string $pattern = null): NumberFormatter
172172
{
173173
return new class($locale, $style, $pattern) extends NumberFormatter {
174174
};
175175
}
176176

177-
protected function getIntlErrorMessage()
177+
protected function getIntlErrorMessage(): string
178178
{
179179
return IntlGlobals::getErrorMessage();
180180
}
@@ -184,7 +184,7 @@ protected function getIntlErrorCode()
184184
return IntlGlobals::getErrorCode();
185185
}
186186

187-
protected function isIntlFailure($errorCode)
187+
protected function isIntlFailure($errorCode): bool
188188
{
189189
return IntlGlobals::isFailure($errorCode);
190190
}

Tests/NumberFormatter/Verification/NumberFormatterTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ public function testGetTextAttribute()
3939
parent::testGetTextAttribute();
4040
}
4141

42-
protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null)
42+
protected function getNumberFormatter(?string $locale = 'en', string $style = null, string $pattern = null): \NumberFormatter
4343
{
4444
return new \NumberFormatter($locale, $style, $pattern);
4545
}
4646

47-
protected function getIntlErrorMessage()
47+
protected function getIntlErrorMessage(): string
4848
{
4949
return intl_get_error_message();
5050
}
@@ -54,7 +54,7 @@ protected function getIntlErrorCode()
5454
return intl_get_error_code();
5555
}
5656

57-
protected function isIntlFailure($errorCode)
57+
protected function isIntlFailure($errorCode): bool
5858
{
5959
return intl_is_failure($errorCode);
6060
}

0 commit comments

Comments
 (0)