Skip to content

Commit

Permalink
[DI] Remove unused props from the PhpDumper
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas authored and nicolas-grekas committed Jul 28, 2017
1 parent 3f31266 commit f1aa45c
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,11 @@ private function addProxyClasses()
/**
* Generates the require_once statement for service includes.
*
* @param string $id The service id
* @param Definition $definition
*
* @return string
*/
private function addServiceInclude($id, $definition)
private function addServiceInclude($definition)
{
$template = " require_once %s;\n";
$code = '';
Expand Down Expand Up @@ -335,9 +334,9 @@ private function addServiceInlinedDefinitions($id, $definition)
$code .= $this->addNewInstance($id, $sDefinition, '$'.$name, ' = ');

if (!$this->hasReference($id, $sDefinition->getMethodCalls(), true) && !$this->hasReference($id, $sDefinition->getProperties(), true)) {
$code .= $this->addServiceProperties(null, $sDefinition, $name);
$code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
$code .= $this->addServiceConfigurator(null, $sDefinition, $name);
$code .= $this->addServiceProperties($sDefinition, $name);
$code .= $this->addServiceMethodCalls($sDefinition, $name);
$code .= $this->addServiceConfigurator($sDefinition, $name);
}

$code .= "\n";
Expand Down Expand Up @@ -437,13 +436,12 @@ private function isSimpleInstance($id, Definition $definition)
/**
* Adds method calls to a service definition.
*
* @param string $id
* @param Definition $definition
* @param string $variableName
*
* @return string
*/
private function addServiceMethodCalls($id, Definition $definition, $variableName = 'instance')
private function addServiceMethodCalls(Definition $definition, $variableName = 'instance')
{
$calls = '';
foreach ($definition->getMethodCalls() as $call) {
Expand All @@ -458,7 +456,7 @@ private function addServiceMethodCalls($id, Definition $definition, $variableNam
return $calls;
}

private function addServiceProperties($id, Definition $definition, $variableName = 'instance')
private function addServiceProperties(Definition $definition, $variableName = 'instance')
{
$code = '';
foreach ($definition->getProperties() as $name => $value) {
Expand Down Expand Up @@ -501,9 +499,9 @@ private function addServiceInlinedDefinitionsSetup($id, Definition $definition)
}

$name = (string) $this->definitionVariables->offsetGet($iDefinition);
$code .= $this->addServiceProperties(null, $iDefinition, $name);
$code .= $this->addServiceMethodCalls(null, $iDefinition, $name);
$code .= $this->addServiceConfigurator(null, $iDefinition, $name);
$code .= $this->addServiceProperties($iDefinition, $name);
$code .= $this->addServiceMethodCalls($iDefinition, $name);
$code .= $this->addServiceConfigurator($iDefinition, $name);
}

if ('' !== $code) {
Expand All @@ -516,13 +514,12 @@ private function addServiceInlinedDefinitionsSetup($id, Definition $definition)
/**
* Adds configurator definition.
*
* @param string $id
* @param Definition $definition
* @param string $variableName
*
* @return string
*/
private function addServiceConfigurator($id, Definition $definition, $variableName = 'instance')
private function addServiceConfigurator(Definition $definition, $variableName = 'instance')
{
if (!$callable = $definition->getConfigurator()) {
return '';
Expand Down Expand Up @@ -633,14 +630,14 @@ private function addService($id, Definition $definition)
$code .= sprintf(" throw new RuntimeException('You have requested a synthetic service (\"%s\"). The DIC does not know how to construct this service.');\n }\n", $id);
} else {
$code .=
$this->addServiceInclude($id, $definition).
$this->addServiceInclude($definition).
$this->addServiceLocalTempVariables($id, $definition).
$this->addServiceInlinedDefinitions($id, $definition).
$this->addServiceInstance($id, $definition).
$this->addServiceInlinedDefinitionsSetup($id, $definition).
$this->addServiceProperties($id, $definition).
$this->addServiceMethodCalls($id, $definition).
$this->addServiceConfigurator($id, $definition).
$this->addServiceProperties($definition).
$this->addServiceMethodCalls($definition).
$this->addServiceConfigurator($definition).
$this->addServiceReturn($id, $definition)
;
}
Expand Down

0 comments on commit f1aa45c

Please sign in to comment.