Skip to content

Commit cfcb1dc

Browse files
Merge branch '5.2' into 5.3
* 5.2: Use PHP_OS_FAMILY if possible Fix tests Fix minor typos [WebProfilerBundle] Fix the values of some CSS properties [Yaml] Fixed an exception message Fix ctype_digit deprecation Add a Special Case for Translating Choices in en_US_POSIX
2 parents 29f12c5 + a3646f7 commit cfcb1dc

File tree

14 files changed

+37
-22
lines changed

14 files changed

+37
-22
lines changed

.github/workflows/unit-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
if: "${{ matrix.php == '8.0' && ! matrix.mode }}"
140140
run: |
141141
sed -i 's/"\*\*\/Tests\/"//' composer.json
142-
composer install --optimize-autoloader
142+
composer install -q --optimize-autoloader
143143
SYMFONY_PATCH_TYPE_DECLARATIONS=force=1 php .github/patch-types.php
144144
SYMFONY_PATCH_TYPE_DECLARATIONS=force=1 php .github/patch-types.php # ensure the script is idempotent
145145
echo PHPUNIT="$PHPUNIT,legacy" >> $GITHUB_ENV

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public function getDescribeCallableTestData()
209209
}
210210

211211
/** @dataProvider getClassDescriptionTestData */
212-
public function testGetClassDecription($object, $expectedDescription)
212+
public function testGetClassDescription($object, $expectedDescription)
213213
{
214214
$this->assertEquals($expectedDescription, $this->getDescriptor()->getClassDescription($object));
215215
}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.css.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.container {
2-
max-width: auto;
2+
max-width: none;
33
margin: 0;
44
padding: 0;
55
}
@@ -28,5 +28,5 @@
2828
}
2929

3030
.exception-message-wrapper .container {
31-
min-height: auto;
31+
min-height: unset;
3232
}

src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected function writeError(OutputInterface $output, \Exception $error)
100100

101101
private function getEofShortcut(): string
102102
{
103-
if (false !== strpos(\PHP_OS, 'WIN')) {
103+
if ('Windows' === \PHP_OS_FAMILY) {
104104
return '<comment>Ctrl+Z</comment> then <comment>Enter</comment>';
105105
}
106106

src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1033,14 +1033,14 @@ public function testMaxSecondsBetweenRedraws()
10331033
$bar->setRedrawFrequency(4); // disable step based redraws
10341034
$bar->start();
10351035

1036-
$bar->setProgress(1); // No treshold hit, no redraw
1036+
$bar->setProgress(1); // No threshold hit, no redraw
10371037
$bar->maxSecondsBetweenRedraws(2);
10381038
sleep(1);
10391039
$bar->setProgress(2); // Still no redraw because it takes 2 seconds for a redraw
10401040
sleep(1);
10411041
$bar->setProgress(3); // 1+1 = 2 -> redraw finally
10421042
$bar->setProgress(4); // step based redraw freq hit, redraw even without sleep
1043-
$bar->setProgress(5); // No treshold hit, no redraw
1043+
$bar->setProgress(5); // No threshold hit, no redraw
10441044
$bar->maxSecondsBetweenRedraws(3);
10451045
sleep(2);
10461046
$bar->setProgress(6); // No redraw even though 2 seconds passed. Throttling has priority
@@ -1071,7 +1071,7 @@ public function testMinSecondsBetweenRedraws()
10711071
$bar->setProgress(3); // 1 second passed but we changed threshold, should not draw
10721072
sleep(1);
10731073
$bar->setProgress(4); // 1+1 seconds = 2 seconds passed which conforms threshold, draw
1074-
$bar->setProgress(5); // No treshold hit, no redraw
1074+
$bar->setProgress(5); // No threshold hit, no redraw
10751075

10761076
rewind($output->getStream());
10771077
$this->assertEquals(

src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function testAskMultilineQuestionIncludesHelpText()
218218
{
219219
$expected = 'Write an essay (press Ctrl+D to continue)';
220220

221-
if (false !== strpos(\PHP_OS, 'WIN')) {
221+
if ('Windows' === \PHP_OS_FAMILY) {
222222
$expected = 'Write an essay (press Ctrl+Z then Enter to continue)';
223223
}
224224

src/Symfony/Component/ErrorHandler/DebugClassLoader.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function __construct(callable $classLoader)
208208
} elseif (substr($test, -\strlen($file)) === $file) {
209209
// filesystem is case insensitive and realpath() normalizes the case of characters
210210
self::$caseCheck = 1;
211-
} elseif (false !== stripos(\PHP_OS, 'darwin')) {
211+
} elseif ('Darwin' === \PHP_OS_FAMILY) {
212212
// on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters
213213
self::$caseCheck = 2;
214214
} else {

src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ public function testAmqpStampHeadersAreUsed()
614614
$connection->publish('body', ['Foo' => 'X'], 0, new AmqpStamp(null, \AMQP_NOPARAM, ['headers' => ['Bar' => 'Y']]));
615615
}
616616

617-
public function testAmqpStampDelireryModeIsUsed()
617+
public function testAmqpStampDeliveryModeIsUsed()
618618
{
619619
$factory = new TestAmqpFactory(
620620
$this->createMock(\AMQPConnection::class),

src/Symfony/Component/Messenger/Tests/EventListener/SendFailedMessageForRetryListenerTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ public function testEnvelopeKeepOnlyTheLast10Stamps()
177177
$senderLocator = $this->createMock(ContainerInterface::class);
178178
$senderLocator->expects($this->once())->method('has')->willReturn(true);
179179
$senderLocator->expects($this->once())->method('get')->willReturn($sender);
180-
$retryStategy = $this->createMock(RetryStrategyInterface::class);
181-
$retryStategy->expects($this->once())->method('isRetryable')->willReturn(true);
182-
$retryStategy->expects($this->once())->method('getWaitingTime')->willReturn(1000);
180+
$retryStrategy = $this->createMock(RetryStrategyInterface::class);
181+
$retryStrategy->expects($this->once())->method('isRetryable')->willReturn(true);
182+
$retryStrategy->expects($this->once())->method('getWaitingTime')->willReturn(1000);
183183
$retryStrategyLocator = $this->createMock(ContainerInterface::class);
184184
$retryStrategyLocator->expects($this->once())->method('has')->willReturn(true);
185-
$retryStrategyLocator->expects($this->once())->method('get')->willReturn($retryStategy);
185+
$retryStrategyLocator->expects($this->once())->method('get')->willReturn($retryStrategy);
186186

187187
$listener = new SendFailedMessageForRetryListener($senderLocator, $retryStrategyLocator);
188188

src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@ public function testPassConstraintToViolation()
19881988
$this->assertSame($constraint, $violations[0]->getConstraint());
19891989
}
19901990

1991-
public function testCollectionConstraitViolationHasCorrectContext()
1991+
public function testCollectionConstraintViolationHasCorrectContext()
19921992
{
19931993
$data = [
19941994
'foo' => 'fooValue',

src/Symfony/Component/Yaml/Inline.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ public static function dump($value, int $flags = 0): string
161161
return 'true';
162162
case false === $value:
163163
return 'false';
164-
case ctype_digit($value):
165-
return \is_string($value) ? "'$value'" : (int) $value;
164+
case \is_int($value):
165+
return $value;
166166
case is_numeric($value) && false === strpos($value, "\f") && false === strpos($value, "\n") && false === strpos($value, "\r") && false === strpos($value, "\t") && false === strpos($value, "\v"):
167167
$locale = setlocale(\LC_NUMERIC, 0);
168168
if (false !== $locale) {
@@ -729,7 +729,7 @@ private static function parseTag(string $value, int &$i, int $flags): ?string
729729
$nextOffset += strspn($value, ' ', $nextOffset);
730730

731731
if ('' === $tag && (!isset($value[$nextOffset]) || \in_array($value[$nextOffset], [']', '}', ','], true))) {
732-
throw new ParseException(sprintf('Using the unquoted scalar value "!" is not supported. You must quote it.', $value), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
732+
throw new ParseException('Using the unquoted scalar value "!" is not supported. You must quote it.', self::$parsedLineNumber + 1, $value, self::$parsedFilename);
733733
}
734734

735735
// Is followed by a scalar and is a built-in tag

src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ public function aParentService(): Service1
4242
{
4343
}
4444

45-
public function setContainer(ContainerInterface $container): ContainerInterface
45+
/**
46+
* @return ContainerInterface
47+
*/
48+
public function setContainer(ContainerInterface $container)
4649
{
4750
return $container;
4851
}

src/Symfony/Contracts/Translation/Test/TranslatorTest.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ public function testTransChoiceWithDefaultLocale($expected, $id, $number)
8585
$this->assertEquals($expected, $translator->trans($id, ['%count%' => $number]));
8686
}
8787

88+
/**
89+
* @dataProvider getTransChoiceTests
90+
*/
91+
public function testTransChoiceWithEnUsPosix($expected, $id, $number)
92+
{
93+
$translator = $this->getTranslator();
94+
$translator->setLocale('en_US_POSIX');
95+
96+
$this->assertEquals($expected, $translator->trans($id, ['%count%' => $number]));
97+
}
98+
8899
public function testGetSetLocale()
89100
{
90101
$translator = $this->getTranslator();
@@ -313,7 +324,7 @@ public function successLangcodes()
313324
{
314325
return [
315326
['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']],
316-
['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM']],
327+
['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM', 'en_US_POSIX']],
317328
['3', ['be', 'bs', 'cs', 'hr']],
318329
['4', ['cy', 'mt', 'sl']],
319330
['6', ['ar']],

src/Symfony/Contracts/Translation/TranslatorTrait.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private function getPluralizationRule(float $number, string $locale): int
142142
{
143143
$number = abs($number);
144144

145-
switch ('pt_BR' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) {
145+
switch ('pt_BR' !== $locale && 'en_US_POSIX' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) {
146146
case 'af':
147147
case 'bn':
148148
case 'bg':
@@ -151,6 +151,7 @@ private function getPluralizationRule(float $number, string $locale): int
151151
case 'de':
152152
case 'el':
153153
case 'en':
154+
case 'en_US_POSIX':
154155
case 'eo':
155156
case 'es':
156157
case 'et':

0 commit comments

Comments
 (0)