Skip to content

Commit

Permalink
minor #17086 CS: use nowdoc instead of heredoc (gharlan)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nicolas-grekas committed Dec 28, 2015
2 parents a4c8d59 + 4ba9bab commit f41077b
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions Dumper/PhpDumper.php
Expand Up @@ -558,7 +558,7 @@ private function addService($id, $definition)

$doc = '';
if (ContainerInterface::SCOPE_PROTOTYPE !== $scope) {
$doc .= <<<EOF
$doc .= <<<'EOF'
*
* This service is shared.
Expand All @@ -567,7 +567,7 @@ private function addService($id, $definition)
}

if (!$definition->isPublic()) {
$doc .= <<<EOF
$doc .= <<<'EOF'
*
* This service is private.
Expand Down Expand Up @@ -804,7 +804,7 @@ public function __construct()
$code .= $this->addMethodMap();
$code .= $this->addAliases();

$code .= <<<EOF
$code .= <<<'EOF'
}
EOF;
Expand Down Expand Up @@ -834,11 +834,11 @@ public function __construct()
$code .= "\n \$this->parameters = \$this->getDefaultParameters();\n";
}

$code .= <<<EOF
$code .= <<<'EOF'
\$this->services =
\$this->scopedServices =
\$this->scopeStacks = array();
$this->services =
$this->scopedServices =
$this->scopeStacks = array();
EOF;

$code .= "\n";
Expand All @@ -853,7 +853,7 @@ public function __construct()
$code .= $this->addMethodMap();
$code .= $this->addAliases();

$code .= <<<EOF
$code .= <<<'EOF'
}
EOF;
Expand Down Expand Up @@ -924,36 +924,36 @@ private function addDefaultParametersMethod()

$code = '';
if ($this->container->isFrozen()) {
$code .= <<<EOF
$code .= <<<'EOF'
/**
* {@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))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', \$name));
if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
}
return \$this->parameters[\$name];
return $this->parameters[$name];
}
/**
* {@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}
*/
public function setParameter(\$name, \$value)
public function setParameter($name, $value)
{
throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
}
Expand All @@ -963,11 +963,11 @@ public function setParameter(\$name, \$value)
*/
public function getParameterBag()
{
if (null === \$this->parameterBag) {
\$this->parameterBag = new FrozenParameterBag(\$this->parameters);
if (null === $this->parameterBag) {
$this->parameterBag = new FrozenParameterBag($this->parameters);
}
return \$this->parameterBag;
return $this->parameterBag;
}
EOF;
}
Expand Down Expand Up @@ -1029,7 +1029,7 @@ private function exportParameters($parameters, $path = '', $indent = 12)
*/
private function endClass()
{
return <<<EOF
return <<<'EOF'
}
EOF;
Expand Down

0 comments on commit f41077b

Please sign in to comment.