Skip to content

PHPStan doesn't catch accessing properties on string #12049

Open
@PatrickRose

Description

@PatrickRose

Bug report

A bug hit production for us when we were generating some data to send to an api, the code is something like this

$data[] = [
    // ...
    'ethnicity' -> $learner->ethnicity
];

PHPStan doesn't catch this. Is it possible for PHPStan to catch it?

Code snippet that reproduces the problem

https://phpstan.org/r/ea95c392-9f23-484d-a87a-fb0d106559d5

Expected output

PHPStan should complain about accessing properties on a string

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

It's been a godsend for us here, thank you for working on it!

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