radebatz/type-info-extras

Extras for symfony/type-info

Installs: 527

Dependents: 0

Suggesters: 1

Security: 0

Stars: 3

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/radebatz/type-info-extras

1.0.2 2025-08-04 03:21 UTC

This package is auto-updated.

Last update: 2025-10-26 03:00:39 UTC


README

build License: MIT

TypeInfoExtras

Library adding some extra features to the Symfony Type Info component.

Based on the type-info:7.3 branch.

Basic Usage

<?php

use Radebatz\TypeInfoExtras\TypeResolver\StringTypeResolver as ExtraStringTypeResolver;

$resolver = new ExtraStringTypeResolver();

$type = $resolver->resolve('html-escaped-string');
echo get_class($type); //  Radebatz\TypeInfoExtras\Type\ExplicitType
echo $type->getExplicitType() // "html-escaped-string"

$type = $resolver->resolve('class-string<Foo>');
echo get_class($type); //  Radebatz\TypeInfoExtras\Type\ClassLikeType
echo $type->getExplicitType(); // "class-string"
echo get_class($type->getObjectType()); // Symfony\Component\TypeInfo\Type\ObjectType
echo $type->getObjectType(); // Foo

$type = $resolver->resolve('int<5,20>');
echo get_class($type); //  Radebatz\TypeInfoExtras\Type\IntRangeType

If your code is doing instanceof checks on the returned Type, then you will need to add another case and treat Radebatz\TypeInfoExtras\Tests\Type\ExplicitType same as BuiltinType.