Build a PHP documentation generator that reads DocBlock type annotations and converts them into structured data objects.
Write a static analysis tool that expands partial class name aliases to their fully qualified names using each file's namespace and use statements.
Parse union types and array type expressions from PHP DocBlocks into typed objects for code inspection or IDE tooling.
Create a code reflection utility that understands PHP type hints including primitives, class references, and combined types.
Installed via Composer, requires understanding of PHP DocBlock type syntax to use effectively.
TypeResolver is a PHP library from the phpDocumentor project that reads type expressions found in code documentation comments and turns them into structured objects your code can work with. In PHP, developers write comments above functions and properties (called DocBlocks) to describe what types of values they accept or return, using notation like string|integer or MyClass[]. This library parses those expressions into objects that represent each type, making it easier to build tools that inspect or document PHP code. The library provides two resolvers. The TypeResolver handles PHP type expressions: primitives like string or void, arrays like string[], combined types like string|integer, and references to class names. The FqsenResolver handles references to specific named elements within code: classes, interfaces, traits, functions, constants, properties, and methods. FQSEN stands for Fully Qualified Structural Element Name, which is essentially the full path to a piece of code including its namespace. The most useful capability of both resolvers is expanding partial names into fully qualified ones. When PHP code has a use statement at the top importing a class under a short alias, a type expression might only mention the short name. This library can take the surrounding context (the namespace and the imports in effect at that point in the file) into account and expand the short name to the full class path. You provide this context either manually or by pointing the library at the source file. The package is part of the phpDocumentor ecosystem and is designed to be a low-level building block for documentation generators, static analysis tools, and code reflection utilities. It is installed via Composer and is licensed under the MIT license.
← phpdocumentor on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.