Skip to content

Wrong processing a null coalescing in function/method argument #3659

@Feolius

Description

@Feolius

Bug report

When null coalescing operator is applied to stdObject and is used in function or method calls as an argument, it throws "Access to an undefined property" error.

Code snippet that reproduces the problem

https://phpstan.org/r/91a14845-6307-4c27-b2d3-4e029c7f8864

Expected output

No errors expected. In the example above substituting null coalescing operator by corresponding ternary operator func2(isset($obj->someProperty) ? $obj->someProperty : null); will solve the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions