getFullyQualifiedName()), 'class'); } elseif ($type instanceof \PHPStan\Type\ObjectType) { $classConstTypes[] = new \PhpParser\Node\Expr\ClassConstFetch(new \PhpParser\Node\Name\FullyQualified($type->getClassName()), 'class'); } if ($type instanceof \PHPStan\Type\UnionType) { foreach ($type->getTypes() as $unionedType) { if (!$unionedType instanceof \PHPStan\Type\TypeWithClassName) { throw new \Rector\Core\Exception\ShouldNotHappenException(); } $classConstTypes[] = new \PhpParser\Node\Expr\ClassConstFetch(new \PhpParser\Node\Name\FullyQualified($unionedType->getClassName()), 'class'); } } return $classConstTypes; } }