8000 minor #23613 [DI] Remove unused props from the PhpDumper (dunglas) · symfony/symfony@27a6c1f · GitHub
[go: up one dir, main page]

Skip to content

Commit 27a6c1f

Browse files
minor #23613 [DI] Remove unused props from the PhpDumper (dunglas)
This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes #23613). Discussion ---------- [DI] Remove unused props from the PhpDumper | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | no | New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget updating UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- f1aa45c [DI] Remove unused props from the PhpDumper
2 parents 3f31266 + f1aa45c commit 27a6c1f

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,11 @@ private function addProxyClasses()
255255
/**
256256
* Generates the require_once statement for service includes.
257257
*
258-
* @param string $id The service id
259258
* @param Definition $definition
260259
*
261260
* @return string
262261
*/
263-
private function addServiceInclude($id, $definition)
262+
private function addServiceInclude($definition)
264263
{
265264
$template = " require_once %s;\n";
266265
$code = '';
@@ -335,9 +334,9 @@ private function addServiceInlinedDefinitions($id, $definition)
335334
$code .= $this->addNewInstance($id, $sDefinition, '$'.$name, ' = ');
336335

337336
if (!$this->hasReference($id, $sDefinition->getMethodCalls(), true) && !$this->hasReference($id, $sDefinition->getProperties(), true)) {
338-
$code .= $this->addServiceProperties(null, $sDefinition, $name);
339-
$code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
340-
$code .= $this->addServiceConfigurator(null, $sDefinition, $name);
337+
$code .= $this->addServiceProperties($sDefinition, $name);
338+
$code .= $this->addServiceMethodCalls($sDefinition, $name);
339+
$code .= $this->addServiceConfigurator($sDefinition, $name);
341340
}
342341

343342
$code .= "\n";
@@ -437,13 +436,12 @@ private function isSimpleInstance($id, Definition $definition)
437436
/**
438437
* Adds method calls to a service definition.
439438
*
440-
* @param string $id
441439
* @param Definition $definition
442440
* @param string $variableName
443441
*
444442
* @return string
445443
*/
446-
private function addServiceMethodCalls($id, Definition $definition, $variableName = 'instance')
444+
private function addServiceMethodCalls(Definition $definition, $variableName = 'instance')
447445
{
448446
$calls = '';
449447
foreach ($definition->getMethodCalls() as $call) {
@@ -458,7 +456,7 @@ private function addServiceMethodCalls($id, Definition $definition, $variableNam
458456
return $calls;
459457
}
460458

461-
private function addServiceProperties($id, Definition $definition, $variableName = 'instance')
459+
private function addServiceProperties(Definition $definition, $variableName = 'instance')
462460
{
463461
$code = '';
464462
foreach ($definition->getProperties() as $name => $value) {
@@ -501,9 +499,9 @@ private function addServiceInlinedDefinitionsSetup($id, Definition $definition)
501499
}
502500

503501
$name = (string) $this->definitionVariables->offsetGet($iDefinition);
504-
$code .= $this->addServiceProperties(null, $iDefinition, $name);
505-
$code .= $this->addServiceMethodCalls(null, $iDefinition, $name);
506-
$code .= $this->addServiceConfigurator(null, $iDefinition, $name);
502+
$code .= $this->addServiceProperties($iDefinition, $name);
503+
$code .= $this->addServiceMethodCalls($iDefinition, $name);
504+
$code .= $this->addServiceConfigurator($iDefinition, $name);
507505
}
508506

509507
if ('' !== $code) {
@@ -516,13 +514,12 @@ private function addServiceInlinedDefinitionsSetup($id, Definition $definition)
516514
/**
517515
* Adds configurator definition.
518516
*
519-
* @param string $id
520517
* @param Definition $definition
521518
* @param string $variableName
522519
*
523520
* @return string
524521
*/
525-
private function addServiceConfigurator($id, Definition $definition, $variableName = 'instance')
522+
private function addServiceConfigurator(Definition $definition, $variableName = 'instance')
526523
{
527524
if (!$callable = $definition->getConfigurator()) {
528525
return '';
@@ -633,14 +630,14 @@ private function addService($id, Definition $definition)
633630
$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);
634631
} else {
635632
$code .=
636-
$this->addServiceInclude($id, $definition).
633+
$this->addServiceInclude($definition).
637634
$this->addServiceLocalTempVariables($id, $definition).
638635
$this->addServiceInlinedDefinitions($id, $definition).
639636
$this->addServiceInstance($id, $definition).
640637
$this->addServiceInlinedDefinitionsSetup($id, $definition).
641-
$this->addServiceProperties($id, $definition).
642-
$this->addServiceMethodCalls($id, $definition).
643-
$this->addServiceConfigurator($id, $definition).
638+
$this->addServiceProperties($definition).
639+
$this->addServiceMethodCalls($definition).
640+
$this->addServiceConfigurator($definition).
644641
$this->addServiceReturn($id, $definition)
645642
;
646643
}

0 commit comments

Comments
 (0)
0