Skip to content

Dump parent class name if anonymous #8740

@mvorisek

Description

@mvorisek

Feature request

repro: https://phpstan.org/r/791bb517-28cf-4af3-a2ad-1b4d33f7cddc

expected output:

 Line 	Error
 5 	Method A::x() return type has no value type specified in iterable type array.
 5 	Method class@anonymous/tmp.php:16::x() return type has no value type specified in iterable type array.
-5 	Method class@anonymous/tmp.php:21::x() return type has no value type specified in iterable type array.
+5 	Method stdClass@anonymous/tmp.php:21::x() return type has no value type specified in iterable type array.

When an anonymous class name is dumped, parent class name like stdClass@anonymous should be dumped instead of class@anonymous. This is also how php-src dumps the anonymous classes: https://3v4l.org/3jKZr

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions