Skip to content

Improve the TypeInfo docs #20014

Closed
Closed
@javiereguiluz

Description

@javiereguiluz

In #19554 we merged the contribution that @Korbeil made to document the new TypeInfo component.

After merging it, I have some questions about it:


(1) When/how do you use the feature to build types? We show examples like these:

use Symfony\Component\TypeInfo\Type;

Type::int();
Type::nullable(Type::string());
Type::generic(Type::object(Collection::class), Type::int());

I can't understand how would you use that in a real PHP application. Can anyone show a real example? Thanks!


(2) In the second example, we show how to do $typeResolver = TypeResolver::create(); to get type information from an existing PHP class. But, we don't show any PHP class, so the examples feel a bit abstract to me.

Would anyone please volunteer to provide a good PHP class example that matches those code examples? Thanks!


(3) This component also supports "raw string resolving", but it's lacking a good example of the PHP class with those PHPDoc contents and the needed code to get the type information. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions