Skip to content

Commit 5642dfd

Browse files
minor #17086 CS: use nowdoc instead of heredoc (gharlan)
This PR was merged into the 2.3 branch. Discussion ---------- CS: use nowdoc instead of heredoc | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | — | License | MIT | Doc PR | — if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580 Commits ------- 3dca549 use nowdoc instead of heredoc
2 parents 8f5afcf + b7d1b5c commit 5642dfd

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

Tests/DumperTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function testSetIndentation()
5454
{
5555
$this->dumper->setIndentation(7);
5656

57-
$expected = <<<EOF
57+
$expected = <<<'EOF'
5858
'': bar
5959
foo: '#bar'
6060
'foo''bar': { }
@@ -104,13 +104,13 @@ public function testSpecifications()
104104

105105
public function testInlineLevel()
106106
{
107-
$expected = <<<EOF
107+
$expected = <<<'EOF'
108108
{ '': bar, foo: '#bar', 'foo''bar': { }, bar: [1, foo], foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } } }
109109
EOF;
110110
$this->assertEquals($expected, $this->dumper->dump($this->array, -10), '->dump() takes an inline level argument');
111111
$this->assertEquals($expected, $this->dumper->dump($this->array, 0), '->dump() takes an inline level argument');
112112

113-
$expected = <<<EOF
113+
$expected = <<<'EOF'
114114
'': bar
115115
foo: '#bar'
116116
'foo''bar': { }
@@ -120,7 +120,7 @@ public function testInlineLevel()
120120
EOF;
121121
$this->assertEquals($expected, $this->dumper->dump($this->array, 1), '->dump() takes an inline level argument');
122122

123-
$expected = <<<EOF
123+
$expected = <<<'EOF'
124124
'': bar
125125
foo: '#bar'
126126
'foo''bar': { }
@@ -135,7 +135,7 @@ public function testInlineLevel()
135135
EOF;
136136
$this->assertEquals($expected, $this->dumper->dump($this->array, 2), '->dump() takes an inline level argument');
137137

138-
$expected = <<<EOF
138+
$expected = <<<'EOF'
139139
'': bar
140140
foo: '#bar'
141141
'foo''bar': { }
@@ -154,7 +154,7 @@ public function testInlineLevel()
154154
EOF;
155155
$this->assertEquals($expected, $this->dumper->dump($this->array, 3), '->dump() takes an inline level argument');
156156

157-
$expected = <<<EOF
157+
$expected = <<<'EOF'
158158
'': bar
159159
foo: '#bar'
160160
'foo''bar': { }

Tests/ParserTest.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testTabsInYaml()
9090

9191
public function testEndOfTheDocumentMarker()
9292
{
93-
$yaml = <<<EOF
93+
$yaml = <<<'EOF'
9494
--- %YAML:1.0
9595
foo
9696
...
@@ -473,7 +473,7 @@ public function testNonUtf8Exception()
473473
*/
474474
public function testUnindentedCollectionException()
475475
{
476-
$yaml = <<<EOF
476+
$yaml = <<<'EOF'
477477
478478
collection:
479479
-item1
@@ -490,7 +490,7 @@ public function testUnindentedCollectionException()
490490
*/
491491
public function testShortcutKeyUnindentedCollectionException()
492492
{
493-
$yaml = <<<EOF
493+
$yaml = <<<'EOF'
494494
495495
collection:
496496
- key: foo
@@ -507,7 +507,7 @@ public function testShortcutKeyUnindentedCollectionException()
507507
*/
508508
public function testMultipleDocumentsNotSupportedException()
509509
{
510-
Yaml::parse(<<<EOL
510+
Yaml::parse(<<<'EOL'
511511
# Ranking of 1998 home runs
512512
---
513513
- Mark McGwire
@@ -527,7 +527,7 @@ public function testMultipleDocumentsNotSupportedException()
527527
*/
528528
public function testSequenceInAMapping()
529529
{
530-
Yaml::parse(<<<EOF
530+
Yaml::parse(<<<'EOF'
531531
yaml:
532532
hash: me
533533
- array stuff
@@ -540,7 +540,7 @@ public function testSequenceInAMapping()
540540
*/
541541
public function testMappingInASequence()
542542
{
543-
Yaml::parse(<<<EOF
543+
Yaml::parse(<<<'EOF'
544544
yaml:
545545
- array stuff
546546
hash: me
@@ -550,7 +550,7 @@ public function testMappingInASequence()
550550

551551
public function testEmptyValue()
552552
{
553-
$input = <<<EOF
553+
$input = <<<'EOF'
554554
hash:
555555
EOF;
556556

@@ -568,7 +568,7 @@ public function testCommentAtTheRootIndent()
568568
'class' => 'Bar',
569569
),
570570
),
571-
), Yaml::parse(<<<EOF
571+
), Yaml::parse(<<<'EOF'
572572
# comment 1
573573
services:
574574
# comment 2
@@ -585,7 +585,7 @@ class: Bar
585585

586586
public function testStringBlockWithComments()
587587
{
588-
$this->assertEquals(array('content' => <<<EOT
588+
$this->assertEquals(array('content' => <<<'EOT'
589589
# comment 1
590590
header
591591
@@ -596,7 +596,7 @@ public function testStringBlockWithComments()
596596
597597
footer # comment3
598598
EOT
599-
), Yaml::parse(<<<EOF
599+
), Yaml::parse(<<<'EOF'
600600
content: |
601601
# comment 1
602602
header
@@ -613,7 +613,7 @@ public function testStringBlockWithComments()
613613

614614
public function testFoldedStringBlockWithComments()
615615
{
616-
$this->assertEquals(array(array('content' => <<<EOT
616+
$this->assertEquals(array(array('content' => <<<'EOT'
617617
# comment 1
618618
header
619619
@@ -624,7 +624,7 @@ public function testFoldedStringBlockWithComments()
624624
625625
footer # comment3
626626
EOT
627-
)), Yaml::parse(<<<EOF
627+
)), Yaml::parse(<<<'EOF'
628628
-
629629
content: |
630630
# comment 1
@@ -644,7 +644,7 @@ public function testNestedFoldedStringBlockWithComments()
644644
{
645645
$this->assertEquals(array(array(
646646
'title' => 'some title',
647-
'content' => <<<EOT
647+
'content' => <<<'EOT'
648648
# comment 1
649649
header
650650
@@ -655,7 +655,7 @@ public function testNestedFoldedStringBlockWithComments()
655655
656656
footer # comment3
657657
EOT
658-
)), Yaml::parse(<<<EOF
658+
)), Yaml::parse(<<<'EOF'
659659
-
660660
title: some title
661661
content: |
@@ -684,7 +684,7 @@ public function testReferenceResolvingInInlineStrings()
684684
'map' => array('key' => 'var-value'),
685685
'list_in_map' => array('key' => array('var-value')),
686686
'map_in_map' => array('foo' => array('bar' => 'var-value')),
687-
), Yaml::parse(<<<EOF
687+
), Yaml::parse(<<<'EOF'
688688
var: &var var-value
689689
scalar: *var
690690
list: [ *var ]
@@ -700,7 +700,7 @@ public function testReferenceResolvingInInlineStrings()
700700

701701
public function testYamlDirective()
702702
{
703-
$yaml = <<<EOF
703+
$yaml = <<<'EOF'
704704
%YAML 1.2
705705
---
706706
foo: 1
@@ -711,7 +711,7 @@ public function testYamlDirective()
711711

712712
public function testFloatKeys()
713713
{
714-
$yaml = <<<EOF
714+
$yaml = <<<'EOF'
715715
foo:
716716
1.2: "bar"
717717
1.3: "baz"
@@ -737,7 +737,7 @@ public function testCommentLikeStringsAreNotStrippedInBlockScalars($yaml, $expec
737737

738738
public function getCommentLikeStringInScalarBlockData()
739739
{
740-
$yaml1 = <<<EOT
740+
$yaml1 = <<<'EOT'
741741
pages:
742742
-
743743
title: some title
@@ -756,7 +756,7 @@ public function getCommentLikeStringInScalarBlockData()
756756
'pages' => array(
757757
array(
758758
'title' => 'some title',
759-
'content' => <<<EOT
759+
'content' => <<<'EOT'
760760
# comment 1
761761
header
762762
@@ -772,7 +772,7 @@ public function getCommentLikeStringInScalarBlockData()
772772
),
773773
);
774774

775-
$yaml2 = <<<EOT
775+
$yaml2 = <<<'EOT'
776776
test: |
777777
foo
778778
# bar
@@ -788,7 +788,7 @@ public function getCommentLikeStringInScalarBlockData()
788788
baz
789789
EOT;
790790
$expected2 = array(
791-
'test' => <<<EOT
791+
'test' => <<<'EOT'
792792
foo
793793
# bar
794794
baz
@@ -797,15 +797,15 @@ public function getCommentLikeStringInScalarBlockData()
797797
,
798798
'collection' => array(
799799
array(
800-
'one' => <<<EOT
800+
'one' => <<<'EOT'
801801
foo
802802
# bar
803803
baz
804804
EOT
805805
,
806806
),
807807
array(
808-
'two' => <<<EOT
808+
'two' => <<<'EOT'
809809
foo
810810
# bar
811811
baz

0 commit comments

Comments
 (0)