Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dd23b8b

Browse files
bug #48971 [DependencyInjection] Fix dump order of inlined deps (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- [DependencyInjection] Fix dump order of inlined deps | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #48895 | License | MIT | Doc PR | - Fix confirmed on the provided reproducers. The updated fixture makes more sense also. Commits ------- 1d01452 [DependencyInjection] Fix dump order of inlined deps
2 parents 3c154c7 + 1d01452 commit dd23b8b

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ private function collectCircularReferences(string $sourceId, array $edges, array
497497
$loop = [];
498498
}
499499
}
500-
$this->addCircularReferences($first, $loop, true);
500+
$this->addCircularReferences($first, $loop, $loopByConstructor);
501501
break;
502502
}
503503
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,17 +421,16 @@ protected function getMonologInline_LoggerService()
421421
*/
422422
protected function getPAService()
423423
{
424-
$a = new \stdClass();
425-
426-
$b = ($this->privates['pC'] ?? $this->getPCService());
424+
$a = ($this->privates['pC'] ?? $this->getPCService());
427425

428426
if (isset($this->services['pA'])) {
429427
return $this->services['pA'];
430428
}
429+
$b = new \stdClass();
431430

432-
$this->services['pA'] = $instance = new \stdClass($a, $b);
431+
$this->services['pA'] = $instance = new \stdClass($b, $a);
433432

434-
$a->d = ($this->privates['pD'] ?? $this->getPDService());
433+
$b->d = ($this->privates['pD'] ?? $this->getPDService());
435434

436435
return $instance;
437436
}

0 commit comments

Comments
 (0)