Skip to content

[1.9.0] casting a list<string>|string using (array) should produce list<string>, not array<string> #8280

@gnutix

Description

@gnutix

Bug report

I just upgraded from PHPStan 1.8.10 to 1.9.0 (missed 1.8.11) and noticed that casting using (array) $var or using !is_array($var) ? [$var] : $var on a string does not produce the same type results.

Code snippet that reproduces the problem

https://phpstan.org/r/ce88f445-141e-4f63-8e71-8c815e1f5033

Expected output

Both lines should do the same thing type-wise.

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

<3

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