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();
            }
        }
    }
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();
            }
        }
    }
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 ( ) ; } } }
Register an annotation for a function.

@param FunctionModelInterface $parent     The function to register annotation in.
@param AnnotationInterface    $annotation The annotation to register.

@throws AnnotationParseException If the annotation can not compile.
Register an annotation for a function .