Skip to content

Contradicting return.unusedType and method.childReturnType when overriding method returning nullable array in final class #13588

@stefanfisk

Description

@stefanfisk

Bug report

When defining an method which returns a nullable array there are contradicting errors when a final override never returns null.

If the override keeps the nullable typehint return.unusedType is generated. If the return type is made non-nullable method.childReturnType and missingType.iterableValue are generated.

Code snippet that reproduces the problem

https://phpstan.org/r/bc383a78-979b-41df-a229-74ac9843632e

Expected output

I'd expect one of Baz or Quz to not generate any errors.

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

PHPStan is the cornerstone of a healthy day coding!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions