Skip to content

Take advantage of PHPStan\Type\Type::toPhpDocNode() #7959

@ondrejmirtes

Description

@ondrejmirtes

Feature Request

Hello, I've added Type::toPhpDocNode() in PHPStan 1.10.14. You could use that instead of TypeMapperInterface::mapToPHPStanPhpDocTypeNode() and PHPStanStaticTypeMapper::mapToPHPStanPhpDocTypeNode() to convert PHPStan\Type\Type back into phpstan/phpdoc-parser AST node and be able to delete a bunch of your own code.

Of course, it's not going to be have exactly 1:1 as your code does now, but we can work out the differences together for the best outcome 👍

The advantage of PHPStan\Type\Type::toPhpDocNode() is that it's trying to be as precise as possible, and will also work for any new added types in PHPStan in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions