Skip to content

Complex rules using @return-phpstan seem to no longer work with PHPStan 2.1.53 #14553

@heiglandreas

Description

@heiglandreas

Bug report

We were using the code in https://phpstan.org/r/52564959-605b-4fa9-9765-e3dffe0a2387 with PHPStan 2.1.50 without issue. Version 2.1.53 suddenly complaints about

Foo::getMessage() should return non-empty-array<'html'|'markdown', string>|string but returns array{html?: string, markdown?: string}.  

Is that intended behaviour or a bug?

Code snippet that reproduces the problem

https://phpstan.org/r/52564959-605b-4fa9-9765-e3dffe0a2387

Expected output

No output 😁

Did PHPStan help you today? Did it make you happy in any way?

No response

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