10000 [DI] give priority to container.hot_path over container.no_preload by nicolas-grekas · Pull Request #36749 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DI] give priority to container.hot_path over container.no_preload #36749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[DI] give priority to container.hot_path over container.no_preload
  • Loading branch information
nicolas-grekas committed May 7, 2020
commit 461041f87d68fed7b735de1dc61467a459d87280
A789
Original file line number Diff line numberDiff line change
Expand Up @@ -851,7 +851,7 @@ protected function {$methodName}($lazyInitialization)
if ($definition->isDeprecated()) {
$deprecation = $definition->getDeprecation($id);
$code .= sprintf(" trigger_deprecation(%s, %s, %s);\n\n", $this->export($deprecation['package']), $this->export($deprecation['version']), $this->export($deprecation['message']));
} elseif (!$definition->hasTag($this->preloadTags[1])) {
} elseif ($definition->hasTag($this->hotPathTag) || !$definition->hasTag($this->preloadTags[1])) {
foreach ($this->inlinedDefinitions as $def) {
foreach ($this->getClasses($def, $id) as $class) {
$this->preload[$class] = $class;
Expand Down Expand Up @@ -1017,7 +1017,7 @@ private function addServices(array &$services = null): string
foreach ($definitions as $id => $definition) {
if (!$definition->isSynthetic()) {
$services[$id] = $this->addService($id, $definition);
} elseif (!$definition->hasTag($this->preloadTags[1])) {
} elseif ($definition->hasTag($this->hotPathTag) || !$definition->hasTag($this->preloadTags[1])) {
$services[$id] = null;

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