Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b170889

Browse files
committed
Merge branch '6.0' into 6.1
* 6.0: parse unquoted digits in tag values as integers do not wire the MercureTransportFactory if the MercureBundle is not enabled skip tests if the signal to be sent is not available skip a test if the signal to be sent is not available
2 parents 558fec0 + febf5e9 commit b170889

File tree

7 files changed

+34
-20
lines changed

7 files changed

+34
-20
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2596,7 +2596,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
25962596
}
25972597
}
25982598

2599-
if (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', MercureTransportFactory::class, $parentPackages) && ContainerBuilder::willBeAvailable('symfony/mercure-bundle', MercureBundle::class, $parentPackages)) {
2599+
if (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', MercureTransportFactory::class, $parentPackages) && ContainerBuilder::willBeAvailable('symfony/mercure-bundle', MercureBundle::class, $parentPackages) && \in_array(MercureBundle::class, $container->getParameter('kernel.bundles'), true)) {
26002600
$container->getDefinition($classToServices[MercureTransportFactory::class])
26012601
->replaceArgument('$registry', new Reference(HubRegistry::class));
26022602
} elseif (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', MercureTransportFactory::class, $parentPackages)) {

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,6 +1945,10 @@ public function testSignalSubscriber()
19451945
*/
19461946
public function testSetSignalsToDispatchEvent()
19471947
{
1948+
if (!\defined('SIGUSR1')) {
1949+
$this->markTestSkipped('SIGUSR1 not available');
1950+
}
1951+
19481952
$command = new BaseSignableCommand();
19491953

19501954
$subscriber = new SignalEventSubscriber();
@@ -1977,6 +1981,10 @@ public function testSignalableCommandInterfaceWithoutSignals()
19771981

19781982
public function testSignalableCommandHandlerCalledAfterEventListener()
19791983
{
1984+
if (!\defined('SIGUSR1')) {
1985+
$this->markTestSkipped('SIGUSR1 not available');
1986+
}
1987+
19801988
$command = new SignableCommand();
19811989

19821990
$subscriber = new SignalEventSubscriber();

src/Symfony/Component/Yaml/Inline.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static function parse(string $value = null, int $flags = 0, array &$refer
7777
++$i;
7878
break;
7979
default:
80-
$result = self::parseScalar($value, $flags, null, $i, null === $tag, $references);
80+
$result = self::parseScalar($value, $flags, null, $i, true, $references);
8181
}
8282

8383
// some comments are allowed at the end
@@ -639,7 +639,6 @@ private static function evaluateScalar(string $scalar, int $flags, array &$refer
639639
}
640640

641641
return octdec($value);
642-
// Optimize for returning strings.
643642
case \in_array($scalar[0], ['+', '-', '.'], true) || is_numeric($scalar[0]):
644643
if (Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar)) {
645644
$scalar = str_replace('_', '', $scalar);

src/Symfony/Component/Yaml/Tests/DumperTest.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,6 @@ public function testDumpingTaggedValueSequenceWithInlinedTagValues()
473473
474474
YAML;
475475
$this->assertSame($expected, $yaml);
476-
// @todo Fix the parser, preserve numbers.
477-
$data[2] = new TaggedValue('number', '5');
478476
$this->assertSameData($data, $this->parser->parse($expected, Yaml::PARSE_CUSTOM_TAGS));
479477
}
480478

@@ -503,8 +501,6 @@ public function testDumpingTaggedValueMapRespectsInlineLevel()
503501
504502
YAML;
505503
$this->assertSame($expected, $yaml);
506-
// @todo Fix the parser, preserve numbers.
507-
$data['count'] = new TaggedValue('number', '5');
508504
$this->assertSameData($data, $this->parser->parse($expected, Yaml::PARSE_CUSTOM_TAGS));
509505
}
510506

@@ -558,9 +554,6 @@ public function testDumpingNotInlinedNullTaggedValue()
558554
YAML;
559555

560556
$this->assertSame($expected, $this->dumper->dump($data, 2));
561-
562-
// @todo Fix the parser, don't stringify null.
563-
$data['foo'] = new TaggedValue('bar', 'null');
564557
$this->assertSameData($data, $this->parser->parse($expected, Yaml::PARSE_CUSTOM_TAGS | Yaml::PARSE_CONSTANT));
565558
}
566559

@@ -677,7 +670,7 @@ public function testDumpMultiLineStringAsScalarBlock()
677670
nested_inlined_multi_line_string: { inlined_multi_line: "foo\nbar\r\nempty line:\n\nbaz" }
678671

679672
YAML
680-
);
673+
);
681674
$this->assertSame($expected, $yml);
682675
$this->assertSame($data, $this->parser->parse($yml));
683676
}

src/Symfony/Component/Yaml/Tests/Fixtures/YtsSpecificationExamples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ yaml: |
913913
no int: ! 12
914914
string: !!str 12
915915
php: |
916-
[ 'integer' => 12, 'no int' => '12', 'string' => '12' ]
916+
[ 'integer' => 12, 'no int' => 12, 'string' => '12' ]
917917
---
918918
test: Private types
919919
todo: true

src/Symfony/Component/Yaml/Tests/InlineTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,24 @@ public function testTagWithEmptyValueInMapping()
741741
$this->assertSame('', $value['foo']->getValue());
742742
}
743743

744+
public function testTagWithQuotedInteger()
745+
{
746+
$value = Inline::parse('!number "5"', Yaml::PARSE_CUSTOM_TAGS);
747+
748+
$this->assertInstanceOf(TaggedValue::class, $value);
749+
$this->assertSame('number', $value->getTag());
750+
$this->assertSame('5', $value->getValue());
751+
}
752+
753+
public function testTagWithUnquotedInteger()
754+
{
755+
$value = Inline::parse('!number 5', Yaml::PARSE_CUSTOM_TAGS);
756+
757+
$this->assertInstanceOf(TaggedValue::class, $value);
758+
$this->assertSame('number', $value->getTag());
759+
$this->assertSame(5, $value->getValue());
760+
}
761+
744762
public function testUnfinishedInlineMap()
745763
{
746764
$this->expectException(ParseException::class);

src/Symfony/Component/Yaml/Tests/ParserTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,16 @@ public function testTaggedValueTopLevelNumber()
5454
{
5555
$yml = '!number 5';
5656
$data = $this->parser->parse($yml, Yaml::PARSE_CUSTOM_TAGS);
57-
// @todo Preserve the number, don't turn into string.
58-
$expected = new TaggedValue('number', '5');
57+
$expected = new TaggedValue('number', 5);
5958
$this->assertSameData($expected, $data);
6059
}
6160

6261
public function testTaggedValueTopLevelNull()
6362
{
6463
$yml = '!tag null';
6564
$data = $this->parser->parse($yml, Yaml::PARSE_CUSTOM_TAGS);
66-
// @todo Preserve literal null, don't turn into string.
67-
$expected = new TaggedValue('tag', 'null');
68-
$this->assertSameData($expected, $data);
65+
66+
$this->assertSameData(new TaggedValue('tag', null), $data);
6967
}
7068

7169
public function testTaggedValueTopLevelString()
@@ -1555,8 +1553,6 @@ public function testParseDateAsMappingValue()
15551553
}
15561554

15571555
/**
1558-
* @param $lineNumber
1559-
* @param $yaml
15601556
* @dataProvider parserThrowsExceptionWithCorrectLineNumberProvider
15611557
*/
15621558
public function testParserThrowsExceptionWithCorrectLineNumber($lineNumber, $yaml)
@@ -2310,7 +2306,7 @@ public function taggedValuesProvider()
23102306

23112307
public function testNonSpecificTagSupport()
23122308
{
2313-
$this->assertSame('12', $this->parser->parse('! 12'));
2309+
$this->assertSame(12, $this->parser->parse('! 12'));
23142310
}
23152311

23162312
public function testCustomTagsDisabled()

0 commit comments

Comments
 (0)