I can't find a substitution for this piece of code without using the getNamespace() method:
$class = ClassType::from($myClass, true);
$namespace = $class->getNamespace();
$namespace->addUse(DateTimeInterface::class);
Alternative method should at least be mentioned in documention.