$ show symfony/type-info
The Symfony TypeInfo component is a PHP library for extracting and representing PHP type information. It provides a rich type system that can resolve types from reflection objects, PHP doc comments, raw type strings, and values. The architecture cleanly separates type representation (Type classes), type resolution (Resolver classes), and contextual information (TypeContext). Key features include sophisticated type inference from values, support for complex type constructs (unions, intersections, generics), and integration with PHP doc block templates and type aliases.
The LLM identified 1 files worth highlighting for reuse:
The fromValue() method in TypeFactoryTrait infers PHP types from values with remarkable sophistication. It handles primitives, objects, enums, iterables (recursively determining key/value types), ArrayAccess, and falls back to mixed type. This self-contained pattern demonstrates non-obvious skill in type inference and could be extracted with minimal dependencies (primarily the Type classes it returns).