chore: PHP CS Fixer - update heredoc handling

This commit is contained in:
Dariusz Ruminski
2025-08-10 00:12:49 +02:00
committed by Nicolas Grekas
parent eac689892d
commit 7b423f1523
6 changed files with 120 additions and 88 deletions

View File

@@ -304,48 +304,52 @@ class OutputFormatterTest extends TestCase
$this->assertEquals(<<<EOF
\033[32m
some text\033[39m
EOF
, $formatter->format(<<<'EOF'
EOF,
$formatter->format(<<<'EOF'
<info>
some text</info>
EOF
));
)
);
$this->assertEquals(<<<EOF
\033[32msome text
\033[39m
EOF
, $formatter->format(<<<'EOF'
EOF,
$formatter->format(<<<'EOF'
<info>some text
</info>
EOF
));
)
);
$this->assertEquals(<<<EOF
\033[32m
some text
\033[39m
EOF
, $formatter->format(<<<'EOF'
EOF,
$formatter->format(<<<'EOF'
<info>
some text
</info>
EOF
));
)
);
$this->assertEquals(<<<EOF
\033[32m
some text
more text
\033[39m
EOF
, $formatter->format(<<<'EOF'
EOF,
$formatter->format(<<<'EOF'
<info>
some text
more text
</info>
EOF
));
)
);
}
public function testFormatAndWrap()

View File

@@ -159,8 +159,10 @@ class SymfonyQuestionHelperTest extends AbstractQuestionHelperTestCase
[żółw ] bar
[łabądź] baz
>
EOT
, $output, true);
EOT,
$output,
true
);
}
public function testChoiceQuestionCustomPrompt()
@@ -178,8 +180,10 @@ class SymfonyQuestionHelperTest extends AbstractQuestionHelperTestCase
qqq:
[0] foo
>ccc>
EOT
, $output, true);
EOT,
$output,
true
);
}
protected function getInputStream($input)

View File

@@ -603,8 +603,7 @@ class TableTest extends TestCase
| Dante Alighieri | J. R. R. Tolkien | J. R. R |
+-----------------+------------------+---------+
TABLE
,
TABLE,
true,
],
'Row with formatted cells containing a newline' => [
@@ -632,8 +631,7 @@ class TableTest extends TestCase
| bar | here |
+-------+------------+
TABLE
,
TABLE,
true,
],
'TabeCellStyle with align. Also with rowspan and colspan > 1' => [
@@ -714,8 +712,7 @@ class TableTest extends TestCase
| test | tttt |
+---------------+---------------+-------------------------------------------+
TABLE
,
TABLE,
],
'TabeCellStyle with fg,bg. Also with rowspan and colspan > 1' => [
[],
@@ -783,8 +780,7 @@ class TableTest extends TestCase
| test | tttt |
+---------------+---------------+-------------------------------------------+
TABLE
,
TABLE,
true,
],
'TabeCellStyle with cellFormat. Also with rowspan and colspan > 1' => [
@@ -838,8 +834,7 @@ class TableTest extends TestCase
| test | tttt |
+----------------+---------------+---------------------+
TABLE
,
TABLE,
true,
],
];
@@ -1292,8 +1287,7 @@ class TableTest extends TestCase
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
+---------------+--------- Page 1/2 -------+------------------+
TABLE
,
TABLE,
],
'header contains multiple lines' => [
'Multiline'."\n".'header'."\n".'here',
@@ -1627,8 +1621,7 @@ class TableTest extends TestCase
| Price: 139.25 |
+------------------------------+
EOTXT
,
EOTXT,
['ISBN', 'Title', 'Author', 'Price'],
$books,
];
@@ -1647,8 +1640,7 @@ class TableTest extends TestCase
| 139.25 |
+----------------------+
EOTXT
,
EOTXT,
[],
$books,
];
@@ -1662,8 +1654,7 @@ class TableTest extends TestCase
| Price: 9.95 |
+-------------------------+
EOTXT
,
EOTXT,
['ISBN', 'Títle', 'Author', 'Price'],
[
[
@@ -1689,8 +1680,7 @@ class TableTest extends TestCase
| : 139.25 |
+------------------------------+
EOTXT
,
EOTXT,
['ISBN', 'Title', 'Author'],
$books,
];
@@ -1707,8 +1697,7 @@ class TableTest extends TestCase
| baz: |
+----------+
EOTXT
,
EOTXT,
['foo', 'bar', 'baz'],
[
['one', 'two'],
@@ -1728,8 +1717,7 @@ class TableTest extends TestCase
| baz: 3 |
+-----------+
EOTXT
,
EOTXT,
['foo', 'bar', 'baz'],
[
['one', 'two', 'tree'],
@@ -1753,8 +1741,7 @@ class TableTest extends TestCase
| Price: 139.25 |
+-------------------------+
EOTXT
,
EOTXT,
['ISBN', 'Title', 'Author', 'Price'],
[
['99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'],
@@ -1774,8 +1761,7 @@ class TableTest extends TestCase
| Author: Charles Dickens |
+------------------------------+
EOTXT
,
EOTXT,
['ISBN', 'Title', 'Author'],
[
['<info>99921-58-10-7</info>', '<error>Divine Comedy</error>', '<fg=blue;bg=white>Dante Alighieri</fg=blue;bg=white>'],
@@ -1797,8 +1783,7 @@ class TableTest extends TestCase
| Author: Charles Dickens |
+---------------------------------------------------------------------------------------+
EOTXT
,
EOTXT,
['ISBN', 'Title', 'Author'],
[
['99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'],
@@ -1829,8 +1814,7 @@ class TableTest extends TestCase
| Lorem ipsum dolor sit amet, consectetur |
+--------------------------------------------------------------------------------+
EOTXT
,
EOTXT,
[],
[
[new TableCell('Lorem ipsum dolor sit amet, <fg=white;bg=green>consectetur</> adipiscing elit, <fg=white;bg=red>sed</> do <fg=white;bg=red>eiusmod</> tempor', ['colspan' => 3])],
@@ -1861,8 +1845,7 @@ class TableTest extends TestCase
Price: 139.25
==============================
EOTXT
,
EOTXT,
['ISBN', 'Title', 'Author', 'Price'],
$books,
'borderless',
@@ -1880,8 +1863,7 @@ class TableTest extends TestCase
Author: Charles Dickens
Price: 139.25
EOTXT
,
EOTXT,
['ISBN', 'Title', 'Author', 'Price'],
$books,
'compact',
@@ -1901,8 +1883,7 @@ class TableTest extends TestCase
Price: 139.25
------------------------------
EOTXT
,
EOTXT,
['ISBN', 'Title', 'Author', 'Price'],
$books,
'symfony-style-guide',
@@ -1922,8 +1903,7 @@ class TableTest extends TestCase
Price: 139.25
└──────────────────────────────┘
EOTXT
,
EOTXT,
['ISBN', 'Title', 'Author', 'Price'],
$books,
'box',
@@ -1943,8 +1923,7 @@ class TableTest extends TestCase
Price: 139.25
╚══════════════════════════════╝
EOTXT
,
EOTXT,
['ISBN', 'Title', 'Author', 'Price'],
$books,
'box-double',
@@ -1964,8 +1943,7 @@ class TableTest extends TestCase
| Price: 139.25 |
+---------- Page 1/2 ----------+
EOTXT
,
EOTXT,
['ISBN', 'Title', 'Author', 'Price'],
$books,
'default',
@@ -2045,8 +2023,7 @@ class TableTest extends TestCase
World 2 4
└───────┴───┴───┘
TABLE
,
TABLE,
$this->getOutputContent($output)
);
}
@@ -2107,8 +2084,7 @@ class TableTest extends TestCase
| And a very long line to show difference in previous lines | |
+-----------------------------------------------------------+--------------------+
TABLE
,
TABLE,
$this->getOutputContent($output)
);
}

View File

@@ -55,7 +55,9 @@ class TreeHelperTest extends TestCase
Root
├── Child 1
└── Child 2
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testRenderThreeLevelTree()
@@ -78,7 +80,9 @@ class TreeHelperTest extends TestCase
├── Child 1
└── SubChild 1
└── Child 2
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testRenderMultiLevelTree()
@@ -107,7 +111,9 @@ class TreeHelperTest extends TestCase
└── SubSubChild 1
└── SubChild 2
└── Child 2
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testRenderSingleNodeTree()
@@ -119,7 +125,9 @@ class TreeHelperTest extends TestCase
$tree->render();
$this->assertSame(<<<TREE
Root
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testRenderEmptyTree()
@@ -131,7 +139,9 @@ class TreeHelperTest extends TestCase
$tree->render();
$this->assertSame(<<<TREE
Root
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testRenderDeeplyNestedTree()
@@ -169,7 +179,9 @@ class TreeHelperTest extends TestCase
└── Level 8
└── Level 9
└── Level 10
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testRenderNodeWithMultipleChildren()
@@ -192,7 +204,9 @@ class TreeHelperTest extends TestCase
├── Child 1
├── Child 2
└── Child 3
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testRenderNodeWithMultipleChildrenWithStringConversion()
@@ -212,7 +226,9 @@ class TreeHelperTest extends TestCase
├── Child 1
├── Child 2
└── Child 3
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testRenderTreeWithDuplicateNodeNames()
@@ -235,7 +251,9 @@ class TreeHelperTest extends TestCase
├── Child
└── Child
└── Child
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testRenderTreeWithComplexNodeNames()
@@ -258,7 +276,9 @@ class TreeHelperTest extends TestCase
├── Child 1 (special)
└── Node with spaces
└── Child_2@#$
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testRenderTreeWithCycle()
@@ -310,7 +330,9 @@ class TreeHelperTest extends TestCase
root
├── child1
└── child2
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testCreateWithNestedArray()
@@ -329,7 +351,9 @@ class TreeHelperTest extends TestCase
└── child2.2
└── child2.2.1
└── child3
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testCreateWithoutRoot()
@@ -343,7 +367,9 @@ class TreeHelperTest extends TestCase
$this->assertSame(<<<TREE
├── child1
└── child2
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testCreateWithEmptyArray()

View File

@@ -41,7 +41,9 @@ class TreeStyleTest extends TestCase
└── B12
└── B2
└── C
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testBoxStyle()
@@ -63,7 +65,9 @@ class TreeStyleTest extends TestCase
┗╸ B12
┗╸ B2
┗╸ C
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testBoxDoubleStyle()
@@ -85,7 +89,9 @@ class TreeStyleTest extends TestCase
╚═ B12
╚═ B2
╚═ C
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testCompactStyle()
@@ -107,7 +113,9 @@ class TreeStyleTest extends TestCase
B12
B2
C
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testLightStyle()
@@ -129,7 +137,9 @@ class TreeStyleTest extends TestCase
| | `-- B12
| `-- B2
`-- C
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testMinimalStyle()
@@ -151,7 +161,9 @@ class TreeStyleTest extends TestCase
. . . B12
. . B2
. C
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testRoundedStyle()
@@ -173,7 +185,9 @@ class TreeStyleTest extends TestCase
╰─ B12
╰─ B2
╰─ C
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testCustomPrefix()
@@ -196,7 +210,9 @@ class TreeStyleTest extends TestCase
C D D B F B12
C D B F B2
C B F C
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
private static function createTree(OutputInterface $output, ?TreeStyle $style = null): TreeHelper

View File

@@ -184,7 +184,9 @@ class SymfonyStyleTest extends TestCase
└── B12
└── B2
└── C
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testCreateTreeWithArray()
@@ -205,7 +207,9 @@ class SymfonyStyleTest extends TestCase
└── B12
└── B2
└── C
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testCreateTreeWithIterable()
@@ -226,7 +230,9 @@ class SymfonyStyleTest extends TestCase
└── B12
└── B2
└── C
TREE, self::normalizeLineBreaks(trim($output->fetch())));
TREE,
self::normalizeLineBreaks(trim($output->fetch()))
);
}
public function testCreateTreeWithConsoleOutput()