public function asClassList(CodeBase $code_base, Context $context)
{
// Iterate over each viable class type to see if any
// have the constant we're looking for
foreach ($this->nonNativeTypes()->getTypeSet() as $class_type) {
// Get the class FQSEN
$class_fqsen = $class_type->asFQSEN();
if ($class_type->isStaticType()) {
if (!$context->isInClassScope()) {
throw new IssueException(Issue::fromType(Issue::ContextNotObject)($context->getFile(), $context->getLineNumberStart(), [(string) $class_type]));
}
(yield $context->getClassInScope($code_base));
} else {
// See if the class exists
if (!$code_base->hasClassWithFQSEN($class_fqsen)) {
throw new CodeBaseException($class_fqsen, "Cannot find class {$class_fqsen}");
}
(yield $code_base->getClassByFQSEN($class_fqsen));
}
}
}