8000 [DependencyInjection] Do not preload functions: check if the factory … · symfony/symfony@6fbdf41 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6fbdf41

Browse files
committed
[DependencyInjection] Do not preload functions: check if the factory is the built-in method in the getClasses.
1 parent cfb6b07 commit 6fbdf41

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class %s extends {$options['class']}
353353
EOF;
354354

355355
foreach ($this->preload as $class) {
356-
if (!$class || str_contains($class, '$') || \in_array($class, ['int', 'float', 'string', 'bool', 'resource', 'object', 'array', 'null', 'callable', 'iterable', 'mixed', 'void', 'never'], true) || \function_exists($class)) {
356+
if (!$class || str_contains($class, '$') || \in_array($class, ['int', 'float', 'string', 'bool', 'resource', 'object', 'array', 'null', 'callable', 'iterable', 'mixed', 'void', 'never'], true)) {
357357
continue;
358358
}
359359
if (!(class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) || (new \ReflectionClass($class))->isUserDefined()) {
@@ -2316,6 +2316,10 @@ private function getClasses(Definition $definition, string $id): array
23162316
if (\is_string($factory[0])) {
23172317
$factory[0] = $resolve($factory[0]);
23182318

2319+
if (\function_exists($factory[0])) {
2320+
break;
2321+
}
2322+
23192323
if (false !== $i = strrpos($factory[0], '::')) {
23202324
$factory[0] = substr($factory[0], 0, $i);
23212325
}

0 commit comments

Comments
 (0)
0