Skip to content

Wrong error Using nullsafe method call on non-nullable type #8664

@MatyCZ

Description

@MatyCZ

Bug report

PhpStan is reporting error Using nullsafe method call on non-nullable type UserObject. Use -> instead..

But removing nullsafe operator leads to a fatal PHP error Call to a member function getUsername() on null.

Code snippet that reproduces the problem

https://phpstan.org/r/80f8009c-ab8a-4dde-825f-4bd5c9eea6e5

Expected output

Do not report any error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions