public static function fromFunction(
        string $fn
    ): array
    {
        try {

            $fn = new \ReflectionFunction($fn);
        }
        catch (\ReflectionException $e) {

            throw new Exception(
                "Function {$fn} not found.",
                Exception::FUNCTION_NOT_FOUND
            );
        }

        $docComment = $fn->getDocComment();

        unset($fn);

        if ($docComment === false) {

            return [];
        }

        return Parser::parseDocComment($docComment);
    }
public static function fromFunction(
        string $fn
    ): array
    {
        try {

            $fn = new \ReflectionFunction($fn);
        }
        catch (\ReflectionException $e) {

            throw new Exception(
                "Function {$fn} not found.",
                Exception::FUNCTION_NOT_FOUND
            );
        }

        $docComment = $fn->getDocComment();

        unset($fn);

        if ($docComment === false) {

            return [];
        }

        return Parser::parseDocComment($docComment);
    }
public static function fromFunction ( string $ fn ) : array { try { $ fn = new \ ReflectionFunction ( $ fn ) ; } catch ( \ ReflectionException $ e ) { throw new Exception ( "Function {$fn} not found." , Exception :: FUNCTION_NOT_FOUND ) ; } $ docComment = $ fn -> getDocComment ( ) ; unset ( $ fn ) ; if ( $ docComment === false ) { return [ ] ; } return Parser :: parseDocComment ( $ docComment ) ; }
Extract the annotations from a function.

@param string $fn

@throws \L\Annotation\Exception

@return array
Extract the annotations from a function .