Skip to content

Type B|null gets narrowed to type B when calling a method that returns mixed #9293

@olmstd

Description

@olmstd

Bug report

When calling method that returns mixed on type B|null, it unexpectedly gets narrowed to type B.

Code snippet that reproduces the problem

https://phpstan.org/r/a035f8ad-afc4-438a-a948-edd349afb0ce

Expected output

The type shouldn't get narrowed at all when calling a method that returns mixed.

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

PHPStan is great. Thank you for your hard work.

EDIT: Updated to a simple snippet

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions