8000 bug #36749 [DI] give priority to container.hot_path over container.no… · symfony/symfony@070552e · GitHub
[go: up one dir, main page]

Skip to content

Commit 070552e

Browse files
committed
bug #36749 [DI] give priority to container.hot_path over container.no_preload (nicolas-grekas)
This PR was merged into the 5.1-dev branch. Discussion ---------- [DI] give priority to container.hot_path over container.no_preload | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Spotted by looking at a website skeleton: `ConsoleHandler` is not preloaded right now (because it listens to console events only) while it should (because it is also wired as a monolog handle and is thus on the hot path.) Commits ------- 461041f [DI] give priority to container.hot_path over container.no_preload
2 parents 4eb32cf + 461041f commit 070552e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ protected function {$methodName}($lazyInitialization)
851851
if ($definition->isDeprecated()) {
852852
$deprecation = $definition->getDeprecation($id);
853853
$code .= sprintf(" trigger_deprecation(%s, %s, %s);\n\n", $this->export($deprecation['package']), $this->export($deprecation['version']), $this->export($deprecation['message']));
854-
} elseif (!$definition->hasTag($this->preloadTags[1])) {
854+
} elseif ($definition->hasTag($this->hotPathTag) || !$definition->hasTag($this->preloadTags[1])) {
855855
foreach ($this->inlinedDefinitions as $def) {
856856
foreach ($this->getClasses($def, $id) as $class) {
857857
$this->preload[$class] = $class;
@@ -1017,7 +1017,7 @@ private function addServices(array &$services = null): string
10171017
foreach ($definitions as $id => $definition) {
10181018
if (!$definition->isSynthetic()) {
10191019
$services[$id] = $this->addService($id, $definition);
1020-
} elseif (!$definition->hasTag($this->preloadTags[1])) {
1020+
} elseif ($definition->hasTag($this->hotPathTag) || !$definition->hasTag($this->preloadTags[1])) {
10211021
$services[$id] = null;
10221022

10231023
foreach ($this->getClasses($definition, $id) as $class) {
@@ -1046,7 +1046,7 @@ private function generateServiceFiles(array $services): iterable
10461046
ksort($definitions);
10471047
foreach ($definitions as $id => $definition) {
10481048
if ((list($file, $code) = $services[$id]) && null !== $file && ($definition->isPublic() || !$this->isTrivialInstance($definition) || isset($this->locatedIds[$id]))) {
1049-
yield $file => [$code, !$definition->hasTag($this->preloadTags[1]) && !$definition->isDeprecated() && !$definition->hasErrors()];
1049+
yield $file => [$code, $definition->hasTag($this->hotPathTag) || !$definition->hasTag($this->preloadTags[1]) && !$definition->isDeprecated() && !$definition->hasErrors()];
10501050
}
10511051
}
10521052
}

0 commit comments

Comments
 (0)
0