Skip to content

Commit 00e3090

Browse files
committed
ClassReflection::getConstant() - do not crash on unknown declaring class
1 parent fb9d320 commit 00e3090

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Reflection/ClassReflection.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,13 @@ public function getParentClassesNames(): array
608608

609609
public function hasConstant(string $name): bool
610610
{
611-
return $this->getNativeReflection()->hasConstant($name);
611+
if (!$this->getNativeReflection()->hasConstant($name)) {
612+
return false;
613+
}
614+
615+
$reflectionConstant = $this->getNativeReflection()->getReflectionConstant($name);
616+
617+
return $this->reflectionProvider->hasClass($reflectionConstant->getDeclaringClass()->getName());
612618
}
613619

614620
public function getConstant(string $name): ConstantReflection

0 commit comments

Comments
 (0)