Skip to content

Template base interface/class check is inconsistent with simple type #6589

@mvorisek

Description

@mvorisek

Bug report

follow #6575 (reply in thread)

a) returning Field for expected Field2 does emit an error since level 3
b) returning Field for expected template of Field2 does NOT emit an error until level 7
c) returning Field for expected template of Field does NOT emit an error until level 7

I agree the c) example needs a compromise (fixed in phpstan rel. v1.4.6), but the b) one is clearly not consistent vs. non-template a).

Code snippet that reproduces the problem

https://phpstan.org/r/24ccc414-b3e2-4c7a-b2fe-d02b34722f92

Expected output

Template base interface/class check is consistent with simple type, eg. both checked at level 3.

Method HelloWorldTemplated::getField() should return Field2 but returns Field.
Method HelloWorldSimple::getField()    should return Field2 but returns Field.

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