Skip to content

Commit

Permalink
minor #24426 [DI] remove inheritdoc from dumped container (Tobion)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.4 branch.

Discussion
----------

[DI] remove inheritdoc from dumped container

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

The inheritdoc without adding text is pointless on it's own as any decent IDE will show that those methods are overwriting the base method. This removes it from the dumped container to remove memory and generation time. This goes in the same direction as #23673, #18048 and #24342
It does not affect phpdocs of the compiled container that might actually be useful (factory methods of services explaining if the service is private, shared etc.).

Commits
-------

d779845 [DI] remove inheritdoc from dumped container
  • Loading branch information
fabpot committed Oct 4, 2017
2 parents 2abe788 + d779845 commit 8b7b902
Show file tree
Hide file tree
Showing 23 changed files with 0 additions and 336 deletions.
27 changes: 0 additions & 27 deletions src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
Expand Up @@ -899,25 +899,16 @@ public function __construct()
if ($this->container->isCompiled()) {
$code .= <<<EOF
/*{$this->docStar}
* {@inheritdoc}
*/
public function compile()
{
throw new LogicException('You cannot compile a dumped container that was already compiled.');
}
/*{$this->docStar}
* {@inheritdoc}
*/
public function isCompiled()
{
return true;
}
/*{$this->docStar}
* {@inheritdoc}
*/
public function isFrozen()
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED);
Expand All @@ -931,9 +922,6 @@ public function isFrozen()
if ($this->asFiles) {
$code .= <<<EOF
/*{$this->docStar}
* {@inheritdoc}
*/
protected function load(\$file, \$lazyLoad = true)
{
return require \$file;
Expand Down Expand Up @@ -1125,9 +1113,6 @@ private function addDefaultParametersMethod()
if ($this->container->isCompiled()) {
$code .= <<<'EOF'
/**
* {@inheritdoc}
*/
public function getParameter($name)
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
Expand All @@ -1144,27 +1129,18 @@ public function getParameter($name)
return $this->parameters[$name];
}
/**
* {@inheritdoc}
*/
public function hasParameter($name)
{
$name = $this->normalizeParameterName($name);
return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
}
/**
* {@inheritdoc}
*/
public function setParameter($name, $value)
{
throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
}
/**
* {@inheritdoc}
*/
public function getParameterBag()
{
if (null === $this->parameterBag) {
Expand All @@ -1179,9 +1155,6 @@ public function getParameterBag()
}
EOF;
if ('' === $this->docStar) {
$code = str_replace('/**', '/*', $code);
}

if ($dynamicPhp) {
$loadedDynamicParameters = $this->exportParameters(array_combine(array_keys($dynamicPhp), array_fill(0, count($dynamicPhp), false)), '', 8);
Expand Down
Expand Up @@ -28,25 +28,16 @@ public function __construct()
$this->aliases = array();
}

/**
* {@inheritdoc}
*/
public function compile()
{
throw new LogicException('You cannot compile a dumped container that was already compiled.');
}

/**
* {@inheritdoc}
*/
public function isCompiled()
{
return true;
}

/**
* {@inheritdoc}
*/
public function isFrozen()
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED);
Expand Down
Expand Up @@ -26,25 +26,16 @@ public function __construct()
$this->aliases = array();
}

/**
* {@inheritdoc}
*/
public function compile()
{
throw new LogicException('You cannot compile a dumped container that was already compiled.');
}

/**
* {@inheritdoc}
*/
public function isCompiled()
{
return true;
}

/**
* {@inheritdoc}
*/
public function isFrozen()
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED);
Expand Down
Expand Up @@ -31,25 +31,16 @@ public function __construct()
$this->aliases = array();
}

/**
* {@inheritdoc}
*/
public function compile()
{
throw new LogicException('You cannot compile a dumped container that was already compiled.');
}

/**
* {@inheritdoc}
*/
public function isCompiled()
{
return true;
}

/**
* {@inheritdoc}
*/
public function isFrozen()
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED);
Expand All @@ -67,9 +58,6 @@ protected function getTestService()
return $this->services['test'] = new \stdClass(array('only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end'));
}

/**
* {@inheritdoc}
*/
public function getParameter($name)
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
Expand All @@ -86,27 +74,18 @@ public function getParameter($name)
return $this->parameters[$name];
}

/**
* {@inheritdoc}
*/
public function hasParameter($name)
{
$name = $this->normalizeParameterName($name);

return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
}

/**
* {@inheritdoc}
*/
public function setParameter($name, $value)
{
throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
}

/**
* {@inheritdoc}
*/
public function getParameterBag()
{
if (null === $this->parameterBag) {
Expand Down
Expand Up @@ -35,25 +35,16 @@ public function __construct()
$this->aliases = array();
}

/**
* {@inheritdoc}
*/
public function compile()
{
throw new LogicException('You cannot compile a dumped container that was already compiled.');
}

/**
* {@inheritdoc}
*/
public function isCompiled()
{
return true;
}

/**
* {@inheritdoc}
*/
public function isFrozen()
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED);
Expand All @@ -71,9 +62,6 @@ protected function getTestService()
return $this->services['test'] = new \stdClass(('wiz'.$this->targetDirs[1]), array(('wiz'.$this->targetDirs[1]) => ($this->targetDirs[2].'/')));
}

/**
* {@inheritdoc}
*/
public function getParameter($name)
{
if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) {
Expand All @@ -90,27 +78,18 @@ public function getParameter($name)
return $this->parameters[$name];
}

/**
* {@inheritdoc}
*/
public function hasParameter($name)
{
$name = $this->normalizeParameterName($name);

return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
}

/**
* {@inheritdoc}
*/
public function setParameter($name, $value)
{
throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
}

/**
* {@inheritdoc}
*/
public function getParameterBag()
{
if (null === $this->parameterBag) {
Expand Down
Expand Up @@ -29,25 +29,16 @@ public function __construct()
$this->aliases = array();
}

/**
* {@inheritdoc}
*/
public function compile()
{
throw new LogicException('You cannot compile a dumped container that was already compiled.');
}

/**
* {@inheritdoc}
*/
public function isCompiled()
{
return true;
}

/**
* {@inheritdoc}
*/
public function isFrozen()
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED);
Expand Down
Expand Up @@ -30,25 +30,16 @@ public function __construct()
$this->aliases = array();
}

/**
* {@inheritdoc}
*/
public function compile()
{
throw new LogicException('You cannot compile a dumped container that was already compiled.');
}

/**
* {@inheritdoc}
*/
public function isCompiled()
{
return true;
}

/**
* {@inheritdoc}
*/
public function isFrozen()
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED);
Expand Down
Expand Up @@ -29,25 +29,16 @@ public function __construct()
$this->aliases = array();
}

/**
* {@inheritdoc}
*/
public function compile()
{
throw new LogicException('You cannot compile a dumped container that was already compiled.');
}

/**
* {@inheritdoc}
*/
public function isCompiled()
{
return true;
}

/**
* {@inheritdoc}
*/
public function isFrozen()
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED);
Expand Down

0 comments on commit 8b7b902

Please sign in to comment.