Skip to content

Commit 88520e5

Browse files
committed
Don't call class_exists() on null
1 parent 9c3ee3d commit 88520e5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function generate(\ReflectionClass $originalClass, ClassGenerator $classG
4343
public function getProxifiedClass(Definition $definition): ?string
4444
{
4545
if (!$definition->hasTag('proxy')) {
46-
return class_exists($class = $definition->getClass()) || interface_exists($class, false) ? $class : null;
46+
return ($class = $definition->getClass()) && (class_exists($class) || interface_exists($class, false)) ? $class : null;
4747
}
4848
if (!$definition->isLazy()) {
4949
throw new \InvalidArgumentException(sprintf('Invalid definition for service of class "%s": setting the "proxy" tag on a service requires it to be "lazy".', $definition->getClass()));

src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,13 @@ protected function processValue($value, $isRoot = false)
8888
return parent::processValue($value, $isRoot);
8989
}
9090

91-
if (!$this->autoload && !class_exists($class = $value->getClass(), false) && !interface_exists($class, false)) {
92-
return parent::processValue($value, $isRoot);
91+
if (!$this->autoload) {
92+
if (!$class = $value->getClass()) {
93+
return parent::processValue($value, $isRoot);
94+
}
95+
if (!class_exists($class, false) && !interface_exists($class, false)) {
96+
return parent::processValue($value, $isRoot);
97+
}
9398
}
9499

95100
if (ServiceLocator::class === $value->getClass()) {

0 commit comments

Comments
 (0)