8000 use nowdoc instead of heredoc · symfony/symfony@7ce6b7d · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ce6b7d

Browse files
committed
use nowdoc instead of heredoc
1 parent 36a5141 commit 7ce6b7d
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@ return Symfony\CS\Config\Config::create()
2424
->notPath('src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml')
2525
// test template
2626
->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php')
27+
// explicit heredoc test
28+
->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php')
2729
)
2830
;
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function configure()
3737
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
3838
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
3939
->setDescription('Installs bundles web assets under a public web directory')
40 10000 -
->setHelp(<<<EOT
40+
->setHelp(<<<'EOT'
4141
The <info>%command.name%</info> command installs bundle assets into a given
4242
directory (e.g. the <comment>web</comment> directory).
4343
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function configure()
3737
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
3838
))
3939
->setDescription('Clears the cache')
40-
->setHelp(<<<EOF
40+
->setHelp(<<<'EOF'
4141
The <info>%command.name%</info> command clears the application cache for a given environment
4242
and debug mode:
4343
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function configure()
3333
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
3434
))
3535
->setDescription('Warms up an empty cache')
36-
->setHelp(<<<EOF
36+
->setHelp(<<<'EOF'
3737
The <info>%command.name%</info> command warms up the cache.
3838
3939
Before running this command, the cache must be empty.
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function configure()
3535
new InputArgument('name', InputArgument::OPTIONAL, 'The Bundle or extension alias'),
3636
))
3737
->setDescription('Dumps default configuration for an extension')
38-
->setHelp(<<<EOF
38+
->setHelp(<<<'EOF'
3939
The <info>%command.name%</info> command dumps the default configuration for an extension/bundle.
4040
4141
The extension alias or bundle name can be used:
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function configure()
4949
new InputOption('parameters', null, InputOption::VALUE_NONE, 'Displays parameters for an application'),
5050
))
5151
->setDescription('Displays current services for an application')
52-
->setHelp(<<<EOF
52+
->setHelp(<<<'EOF'
5353
The <info>%command.name%</info> command displays all configured <comment>public</comment> services:
5454
5555
<info>php %command.full_name%</info>
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function configure()
5353
new InputOption('base-uri', null, InputOption::VALUE_REQUIRED, 'The base URI'),
5454
))
5555
->setDescription('Dumps all routes as Apache rewrite rules')
56-
->setHelp(<<<EOF
56+
->setHelp(<<<'EOF'
5757
The <info>%command.name%</info> dumps all routes as Apache rewrite rules.
5858
These can then be used with the ApacheUrlMatcher to use Apache for route
5959
matching.
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected function configure()
5151
new InputArgument('name', InputArgument::OPTIONAL, 'A route name'),
5252
))
5353
->setDescription('Displays current routes for an application')
54-
->setHelp(<<<EOF
54+
->setHelp(<<<'EOF'
5555
The <info>%command.name%</info> displays the configured routes:
5656
5757
<info>php %command.full_name%</info>
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function configure()
5252
new InputArgument('path_info', InputArgument::REQUIRED, 'A path info'),
5353
))
5454
->setDescription('Helps debug routes by simulating a path info match')
55-
->setHelp(<<<EOF
55+
->setHelp(<<<'EOF'
5656
The <info>%command.name%</info> simulates a path info match:
5757
5858
<info>php %command.full_name% /foo</info>
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function configure()
5454
))
5555
->setName('server:run')
5656
->setDescription('Runs PHP built-in web server')
57-
->setHelp(<<<EOF
57+
->setHelp(<<<'EOF'
5858
The <info>%command.name%</info> runs PHP built-in web server:
5959
6060
<info>%command.full_name%</info>
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function configure()
4343
new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'),
4444
))
4545
->setDescription('Updates the translation file')
46-
->setHelp(<<<EOF
46+
->setHelp(<<<'EOF'
4747
The <info>%command.name%</info> command extract translation strings from templates
4848
of a given bundle. It can display them or merge the new ones into the translation files.
4949
When new translation strings are found it can automatically add a prefix to the translation
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ protected function loadCatalogue($locale)
108108
$fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback));
109109
$currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current));
110110

111-
$fallbackContent .= sprintf(<<<EOF
112-
\$catalogue%s = new MessageCatalogue('%s', %s);
113-
\$catalogue%s->addFallbackCatalogue(\$catalogue%s);
111+
$fallbackContent .= sprintf(<<<'EOF'
112+
$catalogue%s = new MessageCatalogue('%s', %s);
113+
$catalogue%s->addFallbackCatalogue($catalogue%s);
114114

115115

116116
EOF
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function configure()
4343
$this
4444
->setName('init:acl')
4545
->setDescription('Mounts ACL tables in the database')
46-
->setHelp(<<<EOF
46+
->setHelp(<<<'EOF'
4747
The <info>%command.name%</info> command mounts ACL tables in the database.
4848
4949
<info>php %command.full_name%</info>
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected function configure()
2929
->setName('twig:lint')
3030
->setDescription('Lints a template and outputs encountered errors')
3131
->addArgument('filename')
32-
->setHelp(<<<EOF
32+
->setHelp(<<<'EOF'
3333
The <info>%command.name%</info> command lints a template and outputs to stdout
3434
the first encountered syntax error.
3535
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function configure()
5353
->setDefinition(array(
5454
new InputArgument('token', InputArgument::REQUIRED, 'The profile token'),
5555
))
56-
->setHelp(<<<EOF
56+
->setHelp(<<<'EOF'
5757
The <info>%command.name%</info> command exports a profile to the standard output:
5858
5959
<info>php %command.full_name% profile_token</info>
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function configure()
5353
->setDefinition(array(
5454
new InputArgument('filename', InputArgument::OPTIONAL, 'The profile path'),
5555
))
56-
->setHelp(<<<EOF
56+
->setHelp(<<<'EOF'
5757
The <info>%command.name%</info> command imports a profile:
5858
5959
<info>php %command.full_name% profile_filepath</info>
Original file line numberDiff line numberDiff line change
@@ -241,26 +241,26 @@ public function testCommentStripping()
241241

242242
spl_autoload_unregister($r);
243243

244-
$this->assertEquals(<<<EOF
244+
$this->assertEquals(<<<'EOF'
245245
namespace Namespaced
246246
{
247247
class WithComments
248248
{
249-
public static \$loaded = true;
249+
public static $loaded = true;
250250
}
251-
\$string ='string should not be modified {\$string}';
252-
\$heredoc = (<<<HD
251+
$string ='string should not be modified {$string}';
252+
$heredoc = (<<<HD
253253
254254
255-
Heredoc should not be modified {\$string}
255+
Heredoc should not be modified {$string}
256256
257257
258258
HD
259259
);
260-
\$nowdoc =<<<'ND'
260+
$nowdoc =<<<'ND'
261261
262262
263-
Nowdoc should not be modified {\$string}
263+
Nowdoc should not be modified {$string}
264264
265265
266266
ND
@@ -270,7 +270,7 @@ class WithComments
270270
{
271271
class Pearlike_WithComments
272272
{
273-
public static \$loaded = true;
273+
public static $loaded = true;
274274
}
275275
}
276276
EOF
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testDumper()
2626

2727
private function getConfigurationAsString()
2828
{
29-
return <<<EOL
29+
return <<<'EOL'
3030
root:
3131
boolean: true
3232
scalar_empty: ~
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function configure()
4242
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
4343
))
4444
->setDescription('Displays help for a command')
45-
->setHelp(<<<EOF
45+
->setHelp(<<<'EOF'
4646
The <info>%command.name%</info> command displays help for a given command:
4747
4848
<info>php %command.full_name% list</info>
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function configure()
3434
->setName('list')
3535
->setDefinition($this->createDefinition())
3636
->setDescription('Lists commands')
37-
->setHelp(<<<EOF
37+
->setHelp(<<<'EOF'
3838
The <info>%command.name%</info> command lists all commands:
3939
4040
<info>php %command.full_name%</info>
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function run()
6868
if ($this->processIsolation) {
6969
$finder = new PhpExecutableFinder();
7070
$php = $finder->find();
71-
$this->output->writeln(<<<EOF
71+
$this->output->writeln(<<<'EOF'
7272
<info>Running with process isolation, you should consider this:</info>
7373
* each command is executed as separate process,
7474
* commands don't support interactivity, all params must be passed explicitly,
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testExecuteListsCommandsWithRawOption()
3838
$application = new Application();
3939
$commandTester = new CommandTester($command = $application->get('list'));
4040
$commandTester->execute(array('command' => $command->getName(), '--raw' => true));
41-
$output = <<<EOF
41+
$output = <<<'EOF'
4242
help Displays help for a command
4343
list Lists commands
4444

@@ -54,7 +54,7 @@ public function testExecuteListsCommandsWithNamespaceArgument()
5454
$application->add(new \FooCommand());
5555
$commandTester = new CommandTester($command = $application->get('list'));
5656
$commandTester->execute(array('command' => $command->getName(), 'namespace' => 'foo', '--raw' => true));
57-
$output = <<<EOF
57+
$output = <<<'EOF'
5858
foo:bar The foo:bar command
5959

6060
EOF;
@@ -69,7 +69,7 @@ public function testExecuteListsCommandsOrder()
6969
$application->add(new \Foo6Command());
7070
$commandTester = new CommandTester($command = $application->get('list'));
7171
$commandTester->execute(array('command' => $command->getName()), array('decorated' => false));
72-
$output = <<<EOF
72+
$output = <<<'EOF'
7373
Console Tool
7474
7575
Usage:
@@ -101,7 +101,7 @@ public function testExecuteListsCommandsOrderRaw()
101101
$application->add(new \Foo6Command());
102102
$commandTester = new CommandTester($command = $application->get('list'));
103103
$command 741A Tester->execute(array('command' => $command->getName(), '--raw' => true));
104-
$output = <<<EOF
104+
$output = <<<'EOF'
105105
help Displays help for a command
106106
list Lists commands
107107
0foo:bar 0foo:bar command
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public function testContentWithLineBreaks()
220220
\033[32m
221221
some text\033[0m
222222
EOF
223-
, $formatter->format(<<<EOF
223+
, $formatter->format(<<<'EOF'
224224
<info>
225225
some text</info>
226226
EOF
@@ -230,7 +230,7 @@ public function testContentWithLineBreaks()
230230
\033[32msome text
231231
\033[0m
232232
EOF
233-
, $formatter->format(<<<EOF
233+
, $formatter->format(<<<'EOF'
234234
<info>some text
235235
</info>
236236
EOF
@@ -241,7 +241,7 @@ public function testContentWithLineBreaks()
241241
some text
242242
\033[0m
243243
EOF
244-
, $formatter->format(<<<EOF
244+
, $formatter->format(<<<'EOF'
245245
<info>
246246
some text
247247
</info>
@@ -254,7 +254,7 @@ public function testContentWithLineBreaks()
254254
more text
255255
\033[0m
256256
EOF
257-
, $formatter->format(<<<EOF
257+
, $formatter->format(<<<'EOF'
258258
<info>
259259
some text
260260
more text
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function testRenderProvider()
9191
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
9292
),
9393
TableHelper::LAYOUT_DEFAULT,
94-
<<<TABLE
94+
<<<'TABLE'
9595
+---------------+--------------------------+------------------+
9696
| ISBN | Title | Author |
9797
+---------------+--------------------------+------------------+
@@ -123,7 +123,7 @@ public function testRenderProvider()
123123
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
124124
),
125125
TableHelper::LAYOUT_DEFAULT,
126-
<<<TABLE
126+
<<<'TABLE'
127127
+---------------+--------------------------+------------------+
128128
| ISBN | Title | |
129129
+---------------+--------------------------+------------------+
@@ -144,7 +144,7 @@ public function testRenderProvider()
144144
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
145145
),
146146
TableHelper::LAYOUT_DEFAULT,
147-
<<<TABLE
147+
<<<'TABLE'
148148
+---------------+--------------------------+------------------+
149149
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
150150
| 9971-5-0210-0 | | |
@@ -163,7 +163,7 @@ public function testRenderProvider()
163163
array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"),
164164
),
165165
TableHelper::LAYOUT_DEFAULT,
166-
<<<TABLE
166+
<<<'TABLE'
167167
+---------------+----------------------------+-----------------+
168168
| ISBN | Title | Author |
169169
+---------------+----------------------------+-----------------+
@@ -183,7 +183,7 @@ public function testRenderProvider()
183183
array('ISBN', 'Title'),
184184
array(),
185185
TableHelper::LAYOUT_DEFAULT,
186-
<<<TABLE
186+
<<<'TABLE'
187187
+------+-------+
188188
| ISBN | Title |
189189
+------+-------+
@@ -203,7 +203,7 @@ public function testRenderProvider()
203203
array('9971-5-0210-0', 'A Tale of Two Cities', '<info>Charles Dickens</>'),
204204
),
205205
TableHelper::LAYOUT_DEFAULT,
206-
<<<TABLE
206+
<<<'TABLE'
207207
+---------------+----------------------+-----------------+
208208
| ISBN | Title | Author |
209209
+---------------+----------------------+-----------------+
@@ -220,7 +220,7 @@ public function testRenderProvider()
220220
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
221221
),
222222
TableHelper::LAYOUT_DEFAULT,
223-
<<<TABLE
223+
<<<'TABLE'
224224
+----------------------------------+----------------------+-----------------+
225225
| ISBN | Title | Author |
226226
+----------------------------------+----------------------+-----------------+
@@ -247,7 +247,7 @@ public function testRenderMultiByte()
247247
$table->render($output = $this->getOutputStream());
248248

249249
$expected =
250-
<<<TABLE
250+
<<<'TABLE'
251251
+------+
252252
| ■■ |
253253
+------+
@@ -273,7 +273,7 @@ public function testRenderFullWidthCharacters()
273273
$table->render($output = $this->getOutputStream());
274274

275275
$expected =
276-
<<<TABLE
276+
<<<'TABLE'
277277
+------------+
278278
| あいうえお |
279279
+------------+
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function getContent(FlattenException $exception)
141141
$ind = $count - $position + 1;
142142
$class = $this->abbrClass($e['class']);
143143
$message = nl2br(htmlspecialchars($e['message'], $flags, $this->charset));
144-
$content .= sprintf(<<<EOF
144+
$content .= sprintf(<<<'EOF'
145145
<div class="block_exception clear_fix">
146146
<h2><span>%d/%d</span> %s: %s</h2>
147147
</div>
@@ -196,7 +196,7 @@ public function getContent(FlattenException $exception)
196196
*/
197197
public function getStylesheet(FlattenException $exception)
198198
{
199-
return <<<EOF
199+
return <<<'EOF'
200200
.sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
201201
.sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
202202
.sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }