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: https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1580

Commits
-------

3dca549 use nowdoc instead of heredoc
This commit is contained in:
Nicolas Grekas 2015-12-28 14:03:05 +01:00
commit a89fe42811
37 changed files with 121 additions and 119 deletions

View File

@ -24,5 +24,7 @@ return Symfony\CS\Config\Config::create()
->notPath('src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml') ->notPath('src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml')
// test template // test template
->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php') ->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php')
// explicit heredoc test
->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php')
) )
; ;

View File

@ -37,7 +37,7 @@ class AssetsInstallCommand extends ContainerAwareCommand
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it') ->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks') ->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
->setDescription('Installs bundles web assets under a public web directory') ->setDescription('Installs bundles web assets under a public web directory')
->setHelp(<<<EOT ->setHelp(<<<'EOT'
The <info>%command.name%</info> command installs bundle assets into a given The <info>%command.name%</info> command installs bundle assets into a given
directory (e.g. the <comment>web</comment> directory). directory (e.g. the <comment>web</comment> directory).

View File

@ -37,7 +37,7 @@ class CacheClearCommand extends ContainerAwareCommand
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'), new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
)) ))
->setDescription('Clears the cache') ->setDescription('Clears the cache')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command clears the application cache for a given environment The <info>%command.name%</info> command clears the application cache for a given environment
and debug mode: and debug mode:

View File

@ -33,7 +33,7 @@ class CacheWarmupCommand extends ContainerAwareCommand
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'), new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
)) ))
->setDescription('Warms up an empty cache') ->setDescription('Warms up an empty cache')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command warms up the cache. The <info>%command.name%</info> command warms up the cache.
Before running this command, the cache must be empty. Before running this command, the cache must be empty.

View File

@ -35,7 +35,7 @@ class ConfigDumpReferenceCommand extends ContainerDebugCommand
new InputArgument('name', InputArgument::OPTIONAL, 'The Bundle or extension alias'), new InputArgument('name', InputArgument::OPTIONAL, 'The Bundle or extension alias'),
)) ))
->setDescription('Dumps default configuration for an extension') ->setDescription('Dumps default configuration for an extension')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command dumps the default configuration for an extension/bundle. The <info>%command.name%</info> command dumps the default configuration for an extension/bundle.
The extension alias or bundle name can be used: The extension alias or bundle name can be used:

View File

@ -49,7 +49,7 @@ class ContainerDebugCommand extends ContainerAwareCommand
new InputOption('parameters', null, InputOption::VALUE_NONE, 'Displays parameters for an application'), new InputOption('parameters', null, InputOption::VALUE_NONE, 'Displays parameters for an application'),
)) ))
->setDescription('Displays current services for an application') ->setDescription('Displays current services for an application')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command displays all configured <comment>public</comment> services: The <info>%command.name%</info> command displays all configured <comment>public</comment> services:
<info>php %command.full_name%</info> <info>php %command.full_name%</info>

View File

@ -53,7 +53,7 @@ class RouterApacheDumperCommand extends ContainerAwareCommand
new InputOption('base-uri', null, InputOption::VALUE_REQUIRED, 'The base URI'), new InputOption('base-uri', null, InputOption::VALUE_REQUIRED, 'The base URI'),
)) ))
->setDescription('Dumps all routes as Apache rewrite rules') ->setDescription('Dumps all routes as Apache rewrite rules')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> dumps all routes as Apache rewrite rules. The <info>%command.name%</info> dumps all routes as Apache rewrite rules.
These can then be used with the ApacheUrlMatcher to use Apache for route These can then be used with the ApacheUrlMatcher to use Apache for route
matching. matching.

View File

@ -51,7 +51,7 @@ class RouterDebugCommand extends ContainerAwareCommand
new InputArgument('name', InputArgument::OPTIONAL, 'A route name'), new InputArgument('name', InputArgument::OPTIONAL, 'A route name'),
)) ))
->setDescription('Displays current routes for an application') ->setDescription('Displays current routes for an application')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> displays the configured routes: The <info>%command.name%</info> displays the configured routes:
<info>php %command.full_name%</info> <info>php %command.full_name%</info>

View File

@ -52,7 +52,7 @@ class RouterMatchCommand extends ContainerAwareCommand
new InputArgument('path_info', InputArgument::REQUIRED, 'A path info'), new InputArgument('path_info', InputArgument::REQUIRED, 'A path info'),
)) ))
->setDescription('Helps debug routes by simulating a path info match') ->setDescription('Helps debug routes by simulating a path info match')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> simulates a path info match: The <info>%command.name%</info> simulates a path info match:
<info>php %command.full_name% /foo</info> <info>php %command.full_name% /foo</info>

View File

@ -54,7 +54,7 @@ class ServerRunCommand extends ContainerAwareCommand
)) ))
->setName('server:run') ->setName('server:run')
->setDescription('Runs PHP built-in web server') ->setDescription('Runs PHP built-in web server')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> runs PHP built-in web server: The <info>%command.name%</info> runs PHP built-in web server:
<info>%command.full_name%</info> <info>%command.full_name%</info>

View File

@ -43,7 +43,7 @@ class TranslationUpdateCommand extends ContainerAwareCommand
new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'), new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'),
)) ))
->setDescription('Updates the translation file') ->setDescription('Updates the translation file')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command extract translation strings from templates The <info>%command.name%</info> command extract translation strings from templates
of a given bundle. It can display them or merge the new ones into the translation files. of a given bundle. It can display them or merge the new ones into the translation files.
When new translation strings are found it can automatically add a prefix to the translation When new translation strings are found it can automatically add a prefix to the translation

View File

@ -108,9 +108,9 @@ class Translator extends BaseTranslator
$fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback)); $fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback));
$currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current)); $currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current));
$fallbackContent .= sprintf(<<<EOF $fallbackContent .= sprintf(<<<'EOF'
\$catalogue%s = new MessageCatalogue('%s', %s); $catalogue%s = new MessageCatalogue('%s', %s);
\$catalogue%s->addFallbackCatalogue(\$catalogue%s); $catalogue%s->addFallbackCatalogue($catalogue%s);
EOF EOF

View File

@ -43,7 +43,7 @@ class InitAclCommand extends ContainerAwareCommand
$this $this
->setName('init:acl') ->setName('init:acl')
->setDescription('Mounts ACL tables in the database') ->setDescription('Mounts ACL tables in the database')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command mounts ACL tables in the database. The <info>%command.name%</info> command mounts ACL tables in the database.
<info>php %command.full_name%</info> <info>php %command.full_name%</info>

View File

@ -29,7 +29,7 @@ class LintCommand extends ContainerAwareCommand
->setName('twig:lint') ->setName('twig:lint')
->setDescription('Lints a template and outputs encountered errors') ->setDescription('Lints a template and outputs encountered errors')
->addArgument('filename') ->addArgument('filename')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command lints a template and outputs to stdout The <info>%command.name%</info> command lints a template and outputs to stdout
the first encountered syntax error. the first encountered syntax error.

View File

@ -53,7 +53,7 @@ class ExportCommand extends Command
->setDefinition(array( ->setDefinition(array(
new InputArgument('token', InputArgument::REQUIRED, 'The profile token'), new InputArgument('token', InputArgument::REQUIRED, 'The profile token'),
)) ))
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command exports a profile to the standard output: The <info>%command.name%</info> command exports a profile to the standard output:
<info>php %command.full_name% profile_token</info> <info>php %command.full_name% profile_token</info>

View File

@ -53,7 +53,7 @@ class ImportCommand extends Command
->setDefinition(array( ->setDefinition(array(
new InputArgument('filename', InputArgument::OPTIONAL, 'The profile path'), new InputArgument('filename', InputArgument::OPTIONAL, 'The profile path'),
)) ))
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command imports a profile: The <info>%command.name%</info> command imports a profile:
<info>php %command.full_name% profile_filepath</info> <info>php %command.full_name% profile_filepath</info>

View File

@ -241,26 +241,26 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase
spl_autoload_unregister($r); spl_autoload_unregister($r);
$this->assertEquals(<<<EOF $this->assertEquals(<<<'EOF'
namespace Namespaced namespace Namespaced
{ {
class WithComments class WithComments
{ {
public static \$loaded = true; public static $loaded = true;
} }
\$string ='string should not be modified {\$string}'; $string ='string should not be modified {$string}';
\$heredoc = (<<<HD $heredoc = (<<<HD
Heredoc should not be modified {\$string} Heredoc should not be modified {$string}
HD HD
); );
\$nowdoc =<<<'ND' $nowdoc =<<<'ND'
Nowdoc should not be modified {\$string} Nowdoc should not be modified {$string}
ND ND
@ -270,7 +270,7 @@ namespace
{ {
class Pearlike_WithComments class Pearlike_WithComments
{ {
public static \$loaded = true; public static $loaded = true;
} }
} }
EOF EOF

View File

@ -26,7 +26,7 @@ class ReferenceDumperTest extends \PHPUnit_Framework_TestCase
private function getConfigurationAsString() private function getConfigurationAsString()
{ {
return <<<EOL return <<<'EOL'
root: root:
boolean: true boolean: true
scalar_empty: ~ scalar_empty: ~

View File

@ -42,7 +42,7 @@ class HelpCommand extends Command
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
)) ))
->setDescription('Displays help for a command') ->setDescription('Displays help for a command')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command displays help for a given command: The <info>%command.name%</info> command displays help for a given command:
<info>php %command.full_name% list</info> <info>php %command.full_name% list</info>

View File

@ -34,7 +34,7 @@ class ListCommand extends Command
->setName('list') ->setName('list')
->setDefinition($this->createDefinition()) ->setDefinition($this->createDefinition())
->setDescription('Lists commands') ->setDescription('Lists commands')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command lists all commands: The <info>%command.name%</info> command lists all commands:
<info>php %command.full_name%</info> <info>php %command.full_name%</info>

View File

@ -68,7 +68,7 @@ class Shell
if ($this->processIsolation) { if ($this->processIsolation) {
$finder = new PhpExecutableFinder(); $finder = new PhpExecutableFinder();
$php = $finder->find(); $php = $finder->find();
$this->output->writeln(<<<EOF $this->output->writeln(<<<'EOF'
<info>Running with process isolation, you should consider this:</info> <info>Running with process isolation, you should consider this:</info>
* each command is executed as separate process, * each command is executed as separate process,
* commands don't support interactivity, all params must be passed explicitly, * commands don't support interactivity, all params must be passed explicitly,

View File

@ -38,7 +38,7 @@ class ListCommandTest extends \PHPUnit_Framework_TestCase
$application = new Application(); $application = new Application();
$commandTester = new CommandTester($command = $application->get('list')); $commandTester = new CommandTester($command = $application->get('list'));
$commandTester->execute(array('command' => $command->getName(), '--raw' => true)); $commandTester->execute(array('command' => $command->getName(), '--raw' => true));
$output = <<<EOF $output = <<<'EOF'
help Displays help for a command help Displays help for a command
list Lists commands list Lists commands
@ -54,7 +54,7 @@ EOF;
$application->add(new \FooCommand()); $application->add(new \FooCommand());
$commandTester = new CommandTester($command = $application->get('list')); $commandTester = new CommandTester($command = $application->get('list'));
$commandTester->execute(array('command' => $command->getName(), 'namespace' => 'foo', '--raw' => true)); $commandTester->execute(array('command' => $command->getName(), 'namespace' => 'foo', '--raw' => true));
$output = <<<EOF $output = <<<'EOF'
foo:bar The foo:bar command foo:bar The foo:bar command
EOF; EOF;
@ -69,7 +69,7 @@ EOF;
$application->add(new \Foo6Command()); $application->add(new \Foo6Command());
$commandTester = new CommandTester($command = $application->get('list')); $commandTester = new CommandTester($command = $application->get('list'));
$commandTester->execute(array('command' => $command->getName()), array('decorated' => false)); $commandTester->execute(array('command' => $command->getName()), array('decorated' => false));
$output = <<<EOF $output = <<<'EOF'
Console Tool Console Tool
Usage: Usage:
@ -101,7 +101,7 @@ EOF;
$application->add(new \Foo6Command()); $application->add(new \Foo6Command());
$commandTester = new CommandTester($command = $application->get('list')); $commandTester = new CommandTester($command = $application->get('list'));
$commandTester->execute(array('command' => $command->getName(), '--raw' => true)); $commandTester->execute(array('command' => $command->getName(), '--raw' => true));
$output = <<<EOF $output = <<<'EOF'
help Displays help for a command help Displays help for a command
list Lists commands list Lists commands
0foo:bar 0foo:bar command 0foo:bar 0foo:bar command

View File

@ -220,7 +220,7 @@ class OutputFormatterTest extends \PHPUnit_Framework_TestCase
\033[32m \033[32m
some text\033[0m some text\033[0m
EOF EOF
, $formatter->format(<<<EOF , $formatter->format(<<<'EOF'
<info> <info>
some text</info> some text</info>
EOF EOF
@ -230,7 +230,7 @@ EOF
\033[32msome text \033[32msome text
\033[0m \033[0m
EOF EOF
, $formatter->format(<<<EOF , $formatter->format(<<<'EOF'
<info>some text <info>some text
</info> </info>
EOF EOF
@ -241,7 +241,7 @@ EOF
some text some text
\033[0m \033[0m
EOF EOF
, $formatter->format(<<<EOF , $formatter->format(<<<'EOF'
<info> <info>
some text some text
</info> </info>
@ -254,7 +254,7 @@ some text
more text more text
\033[0m \033[0m
EOF EOF
, $formatter->format(<<<EOF , $formatter->format(<<<'EOF'
<info> <info>
some text some text
more text more text

View File

@ -91,7 +91,7 @@ class TableHelperTest extends \PHPUnit_Framework_TestCase
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
), ),
TableHelper::LAYOUT_DEFAULT, TableHelper::LAYOUT_DEFAULT,
<<<TABLE <<<'TABLE'
+---------------+--------------------------+------------------+ +---------------+--------------------------+------------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+---------------+--------------------------+------------------+ +---------------+--------------------------+------------------+
@ -123,7 +123,7 @@ TABLE
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
), ),
TableHelper::LAYOUT_DEFAULT, TableHelper::LAYOUT_DEFAULT,
<<<TABLE <<<'TABLE'
+---------------+--------------------------+------------------+ +---------------+--------------------------+------------------+
| ISBN | Title | | | ISBN | Title | |
+---------------+--------------------------+------------------+ +---------------+--------------------------+------------------+
@ -144,7 +144,7 @@ TABLE
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
), ),
TableHelper::LAYOUT_DEFAULT, TableHelper::LAYOUT_DEFAULT,
<<<TABLE <<<'TABLE'
+---------------+--------------------------+------------------+ +---------------+--------------------------+------------------+
| 99921-58-10-7 | Divine Comedy | Dante Alighieri | | 99921-58-10-7 | Divine Comedy | Dante Alighieri |
| 9971-5-0210-0 | | | | 9971-5-0210-0 | | |
@ -163,7 +163,7 @@ TABLE
array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"), array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"),
), ),
TableHelper::LAYOUT_DEFAULT, TableHelper::LAYOUT_DEFAULT,
<<<TABLE <<<'TABLE'
+---------------+----------------------------+-----------------+ +---------------+----------------------------+-----------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+---------------+----------------------------+-----------------+ +---------------+----------------------------+-----------------+
@ -183,7 +183,7 @@ TABLE
array('ISBN', 'Title'), array('ISBN', 'Title'),
array(), array(),
TableHelper::LAYOUT_DEFAULT, TableHelper::LAYOUT_DEFAULT,
<<<TABLE <<<'TABLE'
+------+-------+ +------+-------+
| ISBN | Title | | ISBN | Title |
+------+-------+ +------+-------+
@ -203,7 +203,7 @@ TABLE
array('9971-5-0210-0', 'A Tale of Two Cities', '<info>Charles Dickens</>'), array('9971-5-0210-0', 'A Tale of Two Cities', '<info>Charles Dickens</>'),
), ),
TableHelper::LAYOUT_DEFAULT, TableHelper::LAYOUT_DEFAULT,
<<<TABLE <<<'TABLE'
+---------------+----------------------+-----------------+ +---------------+----------------------+-----------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+---------------+----------------------+-----------------+ +---------------+----------------------+-----------------+
@ -220,7 +220,7 @@ TABLE
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
), ),
TableHelper::LAYOUT_DEFAULT, TableHelper::LAYOUT_DEFAULT,
<<<TABLE <<<'TABLE'
+----------------------------------+----------------------+-----------------+ +----------------------------------+----------------------+-----------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+----------------------------------+----------------------+-----------------+ +----------------------------------+----------------------+-----------------+
@ -247,7 +247,7 @@ TABLE
$table->render($output = $this->getOutputStream()); $table->render($output = $this->getOutputStream());
$expected = $expected =
<<<TABLE <<<'TABLE'
+------+ +------+
| ■■ | | ■■ |
+------+ +------+
@ -273,7 +273,7 @@ TABLE;
$table->render($output = $this->getOutputStream()); $table->render($output = $this->getOutputStream());
$expected = $expected =
<<<TABLE <<<'TABLE'
+------------+ +------------+
| あいうえお | | あいうえお |
+------------+ +------------+

View File

@ -141,7 +141,7 @@ class ExceptionHandler
$ind = $count - $position + 1; $ind = $count - $position + 1;
$class = $this->abbrClass($e['class']); $class = $this->abbrClass($e['class']);
$message = nl2br(htmlspecialchars($e['message'], $flags, $this->charset)); $message = nl2br(htmlspecialchars($e['message'], $flags, $this->charset));
$content .= sprintf(<<<EOF $content .= sprintf(<<<'EOF'
<div class="block_exception clear_fix"> <div class="block_exception clear_fix">
<h2><span>%d/%d</span> %s: %s</h2> <h2><span>%d/%d</span> %s: %s</h2>
</div> </div>
@ -196,7 +196,7 @@ EOF;
*/ */
public function getStylesheet(FlattenException $exception) public function getStylesheet(FlattenException $exception)
{ {
return <<<EOF return <<<'EOF'
.sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 } .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
.sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; } .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
.sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; } .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }

View File

@ -558,7 +558,7 @@ class PhpDumper extends Dumper
$doc = ''; $doc = '';
if (ContainerInterface::SCOPE_PROTOTYPE !== $scope) { if (ContainerInterface::SCOPE_PROTOTYPE !== $scope) {
$doc .= <<<EOF $doc .= <<<'EOF'
* *
* This service is shared. * This service is shared.
@ -567,7 +567,7 @@ EOF;
} }
if (!$definition->isPublic()) { if (!$definition->isPublic()) {
$doc .= <<<EOF $doc .= <<<'EOF'
* *
* This service is private. * This service is private.
@ -804,7 +804,7 @@ EOF;
$code .= $this->addMethodMap(); $code .= $this->addMethodMap();
$code .= $this->addAliases(); $code .= $this->addAliases();
$code .= <<<EOF $code .= <<<'EOF'
} }
EOF; EOF;
@ -834,11 +834,11 @@ EOF;
$code .= "\n \$this->parameters = \$this->getDefaultParameters();\n"; $code .= "\n \$this->parameters = \$this->getDefaultParameters();\n";
} }
$code .= <<<EOF $code .= <<<'EOF'
\$this->services = $this->services =
\$this->scopedServices = $this->scopedServices =
\$this->scopeStacks = array(); $this->scopeStacks = array();
EOF; EOF;
$code .= "\n"; $code .= "\n";
@ -853,7 +853,7 @@ EOF;
$code .= $this->addMethodMap(); $code .= $this->addMethodMap();
$code .= $this->addAliases(); $code .= $this->addAliases();
$code .= <<<EOF $code .= <<<'EOF'
} }
EOF; EOF;
@ -924,36 +924,36 @@ EOF;
$code = ''; $code = '';
if ($this->container->isFrozen()) { if ($this->container->isFrozen()) {
$code .= <<<EOF $code .= <<<'EOF'
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getParameter(\$name) public function getParameter($name)
{ {
\$name = strtolower(\$name); $name = strtolower($name);
if (!(isset(\$this->parameters[\$name]) || array_key_exists(\$name, \$this->parameters))) { if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', \$name)); throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
} }
return \$this->parameters[\$name]; return $this->parameters[$name];
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function hasParameter(\$name) public function hasParameter($name)
{ {
\$name = strtolower(\$name); $name = strtolower($name);
return isset(\$this->parameters[\$name]) || array_key_exists(\$name, \$this->parameters); return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setParameter(\$name, \$value) public function setParameter($name, $value)
{ {
throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
} }
@ -963,11 +963,11 @@ EOF;
*/ */
public function getParameterBag() public function getParameterBag()
{ {
if (null === \$this->parameterBag) { if (null === $this->parameterBag) {
\$this->parameterBag = new FrozenParameterBag(\$this->parameters); $this->parameterBag = new FrozenParameterBag($this->parameters);
} }
return \$this->parameterBag; return $this->parameterBag;
} }
EOF; EOF;
} }
@ -1029,7 +1029,7 @@ EOF;
*/ */
private function endClass() private function endClass()
{ {
return <<<EOF return <<<'EOF'
} }
EOF; EOF;

View File

@ -117,7 +117,7 @@ class CrawlerTest extends \PHPUnit_Framework_TestCase
$internalErrors = libxml_use_internal_errors(true); $internalErrors = libxml_use_internal_errors(true);
$crawler = new Crawler(); $crawler = new Crawler();
$crawler->addHtmlContent(<<<EOF $crawler->addHtmlContent(<<<'EOF'
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@ -158,7 +158,7 @@ EOF
$internalErrors = libxml_use_internal_errors(true); $internalErrors = libxml_use_internal_errors(true);
$crawler = new Crawler(); $crawler = new Crawler();
$crawler->addXmlContent(<<<EOF $crawler->addXmlContent(<<<'EOF'
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@ -518,7 +518,7 @@ EOF
public function testSelectButtonWithSingleQuotesInNameAttribute() public function testSelectButtonWithSingleQuotesInNameAttribute()
{ {
$html = <<<HTML $html = <<<'HTML'
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<body> <body>
@ -539,7 +539,7 @@ HTML;
public function testSelectButtonWithDoubleQuotesInNameAttribute() public function testSelectButtonWithDoubleQuotesInNameAttribute()
{ {
$html = <<<HTML $html = <<<'HTML'
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<body> <body>
@ -578,7 +578,7 @@ HTML;
public function testSelectLinkAndLinkFiltered() public function testSelectLinkAndLinkFiltered()
{ {
$html = <<<HTML $html = <<<'HTML'
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<body> <body>

View File

@ -25,7 +25,7 @@ class PhpBundleWriter implements BundleWriterInterface
*/ */
public function write($path, $locale, $data) public function write($path, $locale, $data)
{ {
$template = <<<TEMPLATE $template = <<<'TEMPLATE'
<?php <?php
return %s; return %s;

View File

@ -35,7 +35,7 @@ $argc = $_SERVER['argc'];
$argv = $_SERVER['argv']; $argv = $_SERVER['argv'];
if ($argc > 3 || 2 === $argc && '-h' === $argv[1]) { if ($argc > 3 || 2 === $argc && '-h' === $argv[1]) {
bailout(<<<MESSAGE bailout(<<<'MESSAGE'
Usage: php update-icu-component.php <path/to/icu/source> <path/to/icu/build> Usage: php update-icu-component.php <path/to/icu/source> <path/to/icu/build>
Updates the ICU data for Symfony to the latest version of ICU. Updates the ICU data for Symfony to the latest version of ICU.

View File

@ -30,7 +30,7 @@ PHP
public function testCommandLine() public function testCommandLine()
{ {
$process = new PhpProcess(<<<PHP $process = new PhpProcess(<<<'PHP'
<?php echo 'foobar'; <?php echo 'foobar';
PHP PHP
); );

View File

@ -106,16 +106,16 @@ EOF;
*/ */
private function generateGenerateMethod() private function generateGenerateMethod()
{ {
return <<<EOF return <<<'EOF'
public function generate(\$name, \$parameters = array(), \$referenceType = self::ABSOLUTE_PATH) public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
{ {
if (!isset(self::\$declaredRoutes[\$name])) { if (!isset(self::$declaredRoutes[$name])) {
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', \$name)); throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
} }
list(\$variables, \$defaults, \$requirements, \$tokens, \$hostTokens) = self::\$declaredRoutes[\$name]; list($variables, $defaults, $requirements, $tokens, $hostTokens) = self::$declaredRoutes[$name];
return \$this->doGenerate(\$variables, \$defaults, \$requirements, \$tokens, \$parameters, \$name, \$referenceType, \$hostTokens); return $this->doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens);
} }
EOF; EOF;
} }

View File

@ -367,7 +367,7 @@ FINDCHILDREN;
*/ */
protected function getSelectObjectIdentityIdSql(ObjectIdentityInterface $oid) protected function getSelectObjectIdentityIdSql(ObjectIdentityInterface $oid)
{ {
$query = <<<QUERY $query = <<<'QUERY'
SELECT o.id SELECT o.id
FROM %s o FROM %s o
INNER JOIN %s c ON c.id = o.class_id INNER JOIN %s c ON c.id = o.class_id

View File

@ -433,7 +433,7 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
*/ */
protected function getInsertAccessControlEntrySql($classId, $objectIdentityId, $field, $aceOrder, $securityIdentityId, $strategy, $mask, $granting, $auditSuccess, $auditFailure) protected function getInsertAccessControlEntrySql($classId, $objectIdentityId, $field, $aceOrder, $securityIdentityId, $strategy, $mask, $granting, $auditSuccess, $auditFailure)
{ {
$query = <<<QUERY $query = <<<'QUERY'
INSERT INTO %s ( INSERT INTO %s (
class_id, class_id,
object_identity_id, object_identity_id,
@ -510,7 +510,7 @@ QUERY;
*/ */
protected function getInsertObjectIdentitySql($identifier, $classId, $entriesInheriting) protected function getInsertObjectIdentitySql($identifier, $classId, $entriesInheriting)
{ {
$query = <<<QUERY $query = <<<'QUERY'
INSERT INTO %s (class_id, object_identifier, entries_inheriting) INSERT INTO %s (class_id, object_identifier, entries_inheriting)
VALUES (%d, %s, %s) VALUES (%d, %s, %s)
QUERY; QUERY;

View File

@ -110,7 +110,7 @@ class ConstraintViolationListTest extends \PHPUnit_Framework_TestCase
$this->getViolation('Error 5', '', '[baz]'), $this->getViolation('Error 5', '', '[baz]'),
)); ));
$expected = <<<EOF $expected = <<<'EOF'
Root: Root:
Error 1 Error 1
Root.foo.bar: Root.foo.bar:

View File

@ -26,7 +26,7 @@ class ConstraintViolationTest extends \PHPUnit_Framework_TestCase
null null
); );
$expected = <<<EOF $expected = <<<'EOF'
Root.property.path: Root.property.path:
Array Array
EOF; EOF;
@ -45,7 +45,7 @@ EOF;
null null
); );
$expected = <<<EOF $expected = <<<'EOF'
Array.some_value: Array.some_value:
42 cannot be used here 42 cannot be used here
EOF; EOF;

View File

@ -54,7 +54,7 @@ class DumperTest extends \PHPUnit_Framework_TestCase
{ {
$this->dumper->setIndentation(7); $this->dumper->setIndentation(7);
$expected = <<<EOF $expected = <<<'EOF'
'': bar '': bar
foo: '#bar' foo: '#bar'
'foo''bar': { } 'foo''bar': { }
@ -104,13 +104,13 @@ EOF;
public function testInlineLevel() public function testInlineLevel()
{ {
$expected = <<<EOF $expected = <<<'EOF'
{ '': bar, foo: '#bar', 'foo''bar': { }, bar: [1, foo], foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } } } { '': bar, foo: '#bar', 'foo''bar': { }, bar: [1, foo], foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } } }
EOF; EOF;
$this->assertEquals($expected, $this->dumper->dump($this->array, -10), '->dump() takes an inline level argument'); $this->assertEquals($expected, $this->dumper->dump($this->array, -10), '->dump() takes an inline level argument');
$this->assertEquals($expected, $this->dumper->dump($this->array, 0), '->dump() takes an inline level argument'); $this->assertEquals($expected, $this->dumper->dump($this->array, 0), '->dump() takes an inline level argument');
$expected = <<<EOF $expected = <<<'EOF'
'': bar '': bar
foo: '#bar' foo: '#bar'
'foo''bar': { } 'foo''bar': { }
@ -120,7 +120,7 @@ foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } }
EOF; EOF;
$this->assertEquals($expected, $this->dumper->dump($this->array, 1), '->dump() takes an inline level argument'); $this->assertEquals($expected, $this->dumper->dump($this->array, 1), '->dump() takes an inline level argument');
$expected = <<<EOF $expected = <<<'EOF'
'': bar '': bar
foo: '#bar' foo: '#bar'
'foo''bar': { } 'foo''bar': { }
@ -135,7 +135,7 @@ foobar:
EOF; EOF;
$this->assertEquals($expected, $this->dumper->dump($this->array, 2), '->dump() takes an inline level argument'); $this->assertEquals($expected, $this->dumper->dump($this->array, 2), '->dump() takes an inline level argument');
$expected = <<<EOF $expected = <<<'EOF'
'': bar '': bar
foo: '#bar' foo: '#bar'
'foo''bar': { } 'foo''bar': { }
@ -154,7 +154,7 @@ foobar:
EOF; EOF;
$this->assertEquals($expected, $this->dumper->dump($this->array, 3), '->dump() takes an inline level argument'); $this->assertEquals($expected, $this->dumper->dump($this->array, 3), '->dump() takes an inline level argument');
$expected = <<<EOF $expected = <<<'EOF'
'': bar '': bar
foo: '#bar' foo: '#bar'
'foo''bar': { } 'foo''bar': { }

View File

@ -90,7 +90,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase
public function testEndOfTheDocumentMarker() public function testEndOfTheDocumentMarker()
{ {
$yaml = <<<EOF $yaml = <<<'EOF'
--- %YAML:1.0 --- %YAML:1.0
foo foo
... ...
@ -473,7 +473,7 @@ EOF;
*/ */
public function testUnindentedCollectionException() public function testUnindentedCollectionException()
{ {
$yaml = <<<EOF $yaml = <<<'EOF'
collection: collection:
-item1 -item1
@ -490,7 +490,7 @@ EOF;
*/ */
public function testShortcutKeyUnindentedCollectionException() public function testShortcutKeyUnindentedCollectionException()
{ {
$yaml = <<<EOF $yaml = <<<'EOF'
collection: collection:
- key: foo - key: foo
@ -507,7 +507,7 @@ EOF;
*/ */
public function testMultipleDocumentsNotSupportedException() public function testMultipleDocumentsNotSupportedException()
{ {
Yaml::parse(<<<EOL Yaml::parse(<<<'EOL'
# Ranking of 1998 home runs # Ranking of 1998 home runs
--- ---
- Mark McGwire - Mark McGwire
@ -527,7 +527,7 @@ EOL
*/ */
public function testSequenceInAMapping() public function testSequenceInAMapping()
{ {
Yaml::parse(<<<EOF Yaml::parse(<<<'EOF'
yaml: yaml:
hash: me hash: me
- array stuff - array stuff
@ -540,7 +540,7 @@ EOF
*/ */
public function testMappingInASequence() public function testMappingInASequence()
{ {
Yaml::parse(<<<EOF Yaml::parse(<<<'EOF'
yaml: yaml:
- array stuff - array stuff
hash: me hash: me
@ -550,7 +550,7 @@ EOF
public function testEmptyValue() public function testEmptyValue()
{ {
$input = <<<EOF $input = <<<'EOF'
hash: hash:
EOF; EOF;
@ -568,7 +568,7 @@ EOF;
'class' => 'Bar', 'class' => 'Bar',
), ),
), ),
), Yaml::parse(<<<EOF ), Yaml::parse(<<<'EOF'
# comment 1 # comment 1
services: services:
# comment 2 # comment 2
@ -585,7 +585,7 @@ EOF
public function testStringBlockWithComments() public function testStringBlockWithComments()
{ {
$this->assertEquals(array('content' => <<<EOT $this->assertEquals(array('content' => <<<'EOT'
# comment 1 # comment 1
header header
@ -596,7 +596,7 @@ header
footer # comment3 footer # comment3
EOT EOT
), Yaml::parse(<<<EOF ), Yaml::parse(<<<'EOF'
content: | content: |
# comment 1 # comment 1
header header
@ -613,7 +613,7 @@ EOF
public function testFoldedStringBlockWithComments() public function testFoldedStringBlockWithComments()
{ {
$this->assertEquals(array(array('content' => <<<EOT $this->assertEquals(array(array('content' => <<<'EOT'
# comment 1 # comment 1
header header
@ -624,7 +624,7 @@ header
footer # comment3 footer # comment3
EOT EOT
)), Yaml::parse(<<<EOF )), Yaml::parse(<<<'EOF'
- -
content: | content: |
# comment 1 # comment 1
@ -644,7 +644,7 @@ EOF
{ {
$this->assertEquals(array(array( $this->assertEquals(array(array(
'title' => 'some title', 'title' => 'some title',
'content' => <<<EOT 'content' => <<<'EOT'
# comment 1 # comment 1
header header
@ -655,7 +655,7 @@ header
footer # comment3 footer # comment3
EOT EOT
)), Yaml::parse(<<<EOF )), Yaml::parse(<<<'EOF'
- -
title: some title title: some title
content: | content: |
@ -684,7 +684,7 @@ EOF
'map' => array('key' => 'var-value'), 'map' => array('key' => 'var-value'),
'list_in_map' => array('key' => array('var-value')), 'list_in_map' => array('key' => array('var-value')),
'map_in_map' => array('foo' => array('bar' => 'var-value')), 'map_in_map' => array('foo' => array('bar' => 'var-value')),
), Yaml::parse(<<<EOF ), Yaml::parse(<<<'EOF'
var: &var var-value var: &var var-value
scalar: *var scalar: *var
list: [ *var ] list: [ *var ]
@ -700,7 +700,7 @@ EOF
public function testYamlDirective() public function testYamlDirective()
{ {
$yaml = <<<EOF $yaml = <<<'EOF'
%YAML 1.2 %YAML 1.2
--- ---
foo: 1 foo: 1
@ -711,7 +711,7 @@ EOF;
public function testFloatKeys() public function testFloatKeys()
{ {
$yaml = <<<EOF $yaml = <<<'EOF'
foo: foo:
1.2: "bar" 1.2: "bar"
1.3: "baz" 1.3: "baz"
@ -737,7 +737,7 @@ EOF;
public function getCommentLikeStringInScalarBlockData() public function getCommentLikeStringInScalarBlockData()
{ {
$yaml1 = <<<EOT $yaml1 = <<<'EOT'
pages: pages:
- -
title: some title title: some title
@ -756,7 +756,7 @@ EOT;
'pages' => array( 'pages' => array(
array( array(
'title' => 'some title', 'title' => 'some title',
'content' => <<<EOT 'content' => <<<'EOT'
# comment 1 # comment 1
header header
@ -772,7 +772,7 @@ EOT
), ),
); );
$yaml2 = <<<EOT $yaml2 = <<<'EOT'
test: | test: |
foo foo
# bar # bar
@ -788,7 +788,7 @@ collection:
baz baz
EOT; EOT;
$expected2 = array( $expected2 = array(
'test' => <<<EOT 'test' => <<<'EOT'
foo foo
# bar # bar
baz baz
@ -797,7 +797,7 @@ EOT
, ,
'collection' => array( 'collection' => array(
array( array(
'one' => <<<EOT 'one' => <<<'EOT'
foo foo
# bar # bar
baz baz
@ -805,7 +805,7 @@ EOT
, ,
), ),
array( array(
'two' => <<<EOT 'two' => <<<'EOT'
foo foo
# bar # bar
baz baz