Skip to content

method.unused in anonymous class static method #13982

@fedorovsergey

Description

@fedorovsergey

Bug report

Hello! Such code rises an error, but static method is obviously used in class itself
`<?php declare(strict_types = 1);

$v = new class {
public function test2(): string {
return self::test();
}
private static function test(): string {
return 'result';
}
};

$v->test2();`

Code snippet that reproduces the problem

https://phpstan.org/r/dc878513-8066-43ac-b920-a9b7c4e3d523

Expected output

No errors

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

It`s awesome)

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