private function saveFunctionAnnotation(FunctionModelInterface $parent, AnnotationInterface $annotation): void
    {
        if (! $parent->isGlobal() && $parent->isPublic()) {
            // For public or not global function, all annotation except constructor
            if ($annotation->getType() !== AnnotationInterface::TYPE_CONSTRUCT) {
                $annotation->setParentNode($parent);
                $parent->addAnnotation($annotation);
                $annotation->compile();
            }
        } else {
            // Restricted annotation on global or private functions.
            if (Validator::contains($annotation->getType())
                ->validate(AnnotationRegister::ALLOWED_ON_GLOBAL_OR_PRIVATE)) {
                $annotation->setParentNode($parent);
                $parent->addAnnotation($annotation);
                $annotation->compile();
            }
        }
    }