Investigate rewriting DocblockDefinitionLocator to use docblock type parser and type nodes
Investigate rewriting DocblockDefinitionLocator to use docblock type parser and type nodes.
DocblockDefinitionLocator
currently uses regular expressions, which gets the job done for most simple cases. It however poses problems for docblock types which use spaces (warning, currently broken anyway, see #318), intersection types which use &
instead of |
to split types, nested types (array shapes, generic types, callable types, and so on), and potentially other special cases.
We may be able to use PHPStan's lexer to locate boundaries of types, so we can fetch the appropriate range of definitions. The lexer is already used in PhpstanDocblockTypeParser
.