Skip to content

Typecasting (object) array causes phpstan to abort #13424

@kkmuffme

Description

@kkmuffme

Bug report

https://phpstan.org/r/0534c961-d9fc-433e-9717-7e4a6b5910bc

Class Hello was not found while trying to analyse it - discovering symbols is probably not configured properly.

When commenting the (object) typecast, I suddenly get lots more errors, but not the above one anymore:
https://phpstan.org/r/9e903240-b8b2-4110-9922-395bbbaaf380

While this is slightly annoying, the problem is, that when using the (object) array type cast, phpstan always fails to analyse even when the class "Hello" is provided in stubs.
Commenting the type cast resolves the problem

Originally found in rectorphp/rector#9338

Code snippet that reproduces the problem

https://phpstan.org/r/0534c961-d9fc-433e-9717-7e4a6b5910bc

Expected output

Typecast should not lead to aborting of analysis

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions