pub fn parse_str(span: Span, input: &str) -> Result<Type<'_>, ParseError>Expand description
Parses a string representation of a PHPDoc type into an Abstract Syntax Tree (AST).
This is the main entry point for the type parser. It takes the type string
and its original Span (representing its location within the source file)
and returns the parsed Type AST or a ParseError.
§Arguments
span- The originalSpanof theinputstring slice within its source file. This is crucial for ensuring all AST nodes have correct, absolute positioning.input- The&strcontaining the type string to parse (e.g.,"int|string","array<int, MyClass>").
§Returns
Ok(Type)containing the root of the parsed AST on success.Err(ParseError)if any lexing or parsing error occurs.