phpDocumentor

phpDocumentor/TypeResolver

PHP MIT Dev Tools

A PSR-5 based resolver of Class names, Types and Structural Element Names

9.2k stars
51 forks
slow
GitHub +1 / week

9.2k

Stars

51

Forks

10

Open issues

30

Contributors

2.0.0 06 Jan 2026

AI Analysis

TypeResolver is a PHP library that implements PSR-5 specification for resolving type declarations and fully qualified structural element names (FQSENs) from DocBlocks. It specializes in parsing PHP documentation annotations to convert partial class names into fully qualified names and resolve complex type expressions. This tool is essential for documentation generators, static analysis tools, and IDEs that need to interpret PHP documentation metadata.

Dev Tools Library Discovery value: 3/10
Documentation 8/10
Activity 6/10
Community 8/10
Code quality 8/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

php-documentation type-resolution psr-5 static-analysis docblock-parsing
Actively maintained Well documented MIT licensed Niche/specialized use case Production ready
Deep Analysis · Based on README and public signals
2w ago

PHP DocBlock type resolver that quietly powers millions of projects as a silent dependency

phpDocumentor/TypeResolver implements PSR-5 type parsing and resolution for PHP DocBlocks, converting type strings like 'string|int[]' or partial class names into structured value objects with full namespace context. It is built primarily for static analysis tools, documentation generators, IDE plugins, and PHP reflection libraries. Despite modest star counts relative to its actual reach, it is a foundational transitive dependency for tools like PHPStan, Psalm, and phpDocumentor itself, meaning its real adoption is orders of magnitude larger than repository metrics suggest.

Origin

Created in June 2015 as part of the phpDocumentor ecosystem to formalize PSR-5 type handling. It evolved alongside PSR-5 draft specification and has been a stable infrastructure component for over a decade.

Growth

Star growth is nearly flat (1 star in 7 days) because this is infrastructure code — developers rarely star transitive dependencies. Actual adoption grew with the explosion of PHP static analysis tooling (PHPStan, Psalm) in the 2017–2022 period. Its Packagist download counts (not available here but known to be in the hundreds of millions) tell the real growth story.

In production

While direct adoption evidence is not verifiable from this repository alone, phpDocumentor/TypeResolver is a declared dependency of phpDocumentor/ReflectionDocBlock (9,384 stars), which is itself a dependency of PHPUnit, PHPStan, Psalm, and Symfony components. Packagist monthly downloads are publicly known to be in the tens of millions. Adoption is extensively documented through the transitive dependency graph of the PHP ecosystem.

Code analysis
Architecture

Appears to follow a clean value object pattern with distinct TypeResolver and FqsenResolver classes. Types are modeled as typed value objects (Compound, Nullable, String_, Integer, etc.), suggesting an immutable, composable design. Context object carries namespace and import information for partial name resolution — appears well-separated from parsing logic.

Tests

README links to Coveralls and Scrutinizer coverage badges for branch 1.x, indicating automated coverage tracking is in place. Scrutinizer quality badge also present. Exact coverage percentage is not stated in the README excerpt, but the presence of multiple coverage systems suggests the project takes testing seriously.

Maintenance

Last push was April 2, 2026 — approximately 12 weeks before the evaluation date. This indicates active maintenance. The CI badge (GitHub Actions QA workflow) is present and tied to branch 1.x. For a mature, stable library, infrequent commits are expected and do not indicate abandonment.

Honest verdict

ADOPT IF: you are building a PHP static analysis tool, documentation generator, IDE language server, or reflection library that needs to parse and resolve PSR-5 DocBlock types — this is the de facto standard component for that job. AVOID IF: you need runtime type enforcement or PHP 8 native type introspection from source code rather than DocBlocks — this library is scoped to string-based DocBlock type resolution only. MONITOR IF: PSR-5 is finalized or amended in ways that require breaking API changes, or if PHPStan's phpdoc-parser gains sufficient abstraction to displace this as the ecosystem standard.

Independent dimensions

Mainstream potential

3/10

Technical importance

8/10

Adoption evidence

8/10

Risks
  • PSR-5 remains a draft standard; any significant changes to the specification could require breaking changes to the library's API.
  • PHPStan's phpdoc-parser is gaining adoption as an alternative within the static analysis community and could fragment ecosystem standards.
  • As a transitive dependency, the library has limited direct community engagement — issues and maintenance depend heavily on the phpDocumentor core team's bandwidth.
  • PHP's evolution toward native union types, intersection types, and enums may reduce reliance on DocBlock-based type annotation over time, slowly shrinking the problem domain.
  • Low fork count (51) relative to star count may indicate limited external contributor pool, concentrating maintenance risk in the core team.
Prediction

Will remain stable critical infrastructure for the PHP ecosystem for the foreseeable future. Unlikely to see dramatic growth or decline — its fate is tied to the longevity of DocBlock-based type annotations in PHP codebases.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

PHP
99.8%
Makefile
0.1%
Twig
0%

Information

Language
PHP
License
MIT
Last updated
3mo ago
Created
135mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Similar repos

phpDocumentor

phpDocumentor/phpDocumentor

phpDocumentor is a specialized documentation generator for PHP projects that...

4.3k PHP Dev Tools
phpDocumentor

phpDocumentor/ReflectionDocBlock

ReflectionDocBlock is a PHP library that parses DocBlocks (documentation...

9.4k PHP Dev Tools
phpDocumentor

phpDocumentor/ReflectionCommon

ReflectionCommon is a PHP library providing shared reflection interfaces and...

9.1k PHP Dev Tools
phpstan

phpstan/phpdoc-parser

PHPDoc Parser is a specialized PHP library that parses PHPDoc comments into an...

1.5k PHP Dev Tools
doctrine

doctrine/lexer

A lightweight PHP library providing a base lexer implementation for building...

11.2k PHP
vs. alternatives
phpDocumentor/ReflectionDocBlock

Sibling library that depends on TypeResolver. ReflectionDocBlock handles full DocBlock parsing; TypeResolver handles the type-string resolution layer specifically. They are complementary, not competing.

phpstan/phpdoc-parser

PHPStan's own DocBlock parser that also resolves types. More tightly integrated with PHPStan internals and supports extended PHPStan-specific type syntax. TypeResolver is more PSR-5 standards-aligned and framework-agnostic.

doctrine/lexer

Lower-level lexer utility used for tokenization, not type resolution. TypeResolver operates at a higher abstraction level. They solve different layers of the same parsing pipeline.

nikic/php-parser

Full PHP code parser that can also extract type information from PHP source AST. TypeResolver specifically targets DocBlock type strings per PSR-5, not native PHP syntax — different scope and use case.

MichalLytek/type-graphql

TypeScript library for GraphQL schema generation — not a PHP type resolver. Listed as similar by tooling but not a real competitor or alternative for this project's use case.