TypeResolver is a PHP library that resolves class names, types, and structural element names according to the PSR-5 specification for DocBlocks.
The library addresses the problem of parsing and normalizing type declarations found in PHP documentation comments. It provides two main resolvers: TypeResolver handles primitive types, composites like arrays, compound types using union syntax, and class or interface references; FqsenResolver handles fully qualified structural element names, enabling resolution of constants, functions, classes, interfaces, traits, class constants, properties, and methods. Both resolvers can expand partial class names into fully qualified class names when given appropriate namespace context and import information.
Developers should adopt this tool when building documentation generators, static analysis tools, or any system that needs to parse and normalize PHP type hints from DocBlocks. It is particularly valuable for projects that must handle namespace resolution and convert relative class references into fully qualified names. The library's dual-resolver design means you choose TypeResolver for type expressions and FqsenResolver for references to code elements, depending on what your DocBlock parsing needs to accomplish.
The project maintains a steady stream of commits across its codebase with regular updates to core functionality. Pull requests are reviewed and merged consistently, indicating active maintenance. Issues receive responses and are addressed through code changes, demonstrating engagement with user needs. The test suite is regularly updated alongside feature work, suggesting a commitment to code quality as the project evolves.