Skip to content

Uncaught TypeError with nullsafe operator #9284

@sal-lochbaum

Description

@sal-lochbaum

Bug report

PHPStan doesn't detect a possible null value passed to a function that does not expect null when using the nullsafe operator to obtain the value

Code snippet that reproduces the problem

https://phpstan.org/r/c82bad37-9fa0-4954-9235-134774c2014b

Expected output

Parameter #1 $foo of function write expects string, null given.

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

it helps tremendously catching other possible null-pointers and certainly raises awareness for code smell, that's why I came across this missing check, so thank you!

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