Skip to content

phpstan trips over psalm-vendored annotations using custom types #9077

@alcaeus

Description

@alcaeus

Bug report

When using object shapes in a psalm-vendored annotation, phpstan will try to read the annotation and error if it doesn't understand the type.

Code snippet that reproduces the problem

See https://phpstan.org/r/12180a1f-7f95-4e23-a6b8-ae6c59e706b6 for an example. In the example, I'm declaring a type using @psalm-type that uses an object shape. Using this type in a @psalm-return annotation results in an error being reported. To compare, describing the return type directly in @psalm-return does not cause an error.

Expected output

I expect phpstan to not report errors when it can't understand a psalm-vendored annotation. I was surprised to find that phpstan reads psalm-vendored annotation, and while I understand there are benefits to doing so, it should make an effort to not trip over them when it can't understand them.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions