-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
phpstan/phpstan-src
#1303Description
Bug report
Please review the sample code below. This appears to be specific to anonymous classes - if you switch out the anonymous class for a 'real' class that uses the trait there is no issue (e.g. https://phpstan.org/r/2fc4cc39-6ec4-4063-b904-7efaed985648).
Code snippet that reproduces the problem
I'm unable to share a 'try' link as the sample code hangs on there too, but this is a small test-case:
<?php declare(strict_types = 1);
trait foo {
public function getFoo()
{
return new class {
use foo;
};
}
}
class HelloWorld
{
use foo;
}
var_dump((new HelloWorld())->getFoo()->getFoo());
And you can verify that this is valid (if bad) code via this link: https://3v4l.org/VpFPP
Expected output
PHPStan should not hang.
Did PHPStan help you today? Did it make you happy in any way?
Yep, I'm very satisfied with what I've seen with PHPStan with my use-cases so far.
The code that triggered this hang in the first place was actually wrong, so in spite of the hanging it still provided me with valuable information.
Metadata
Metadata
Assignees
Labels
No labels