mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
#8330 - take into account that static
type may have been unwrapped in ExistingAtomicStaticCallAnalyzer#hasStaticInType()
This commit is contained in:
parent
d7cd84c4eb
commit
0c652f72f6
@ -627,7 +627,7 @@ class ExistingAtomicStaticCallAnalyzer
|
||||
*/
|
||||
private static function hasStaticInType(Type\TypeNode $type): bool
|
||||
{
|
||||
if ($type instanceof TNamedObject && $type->value === 'static') {
|
||||
if ($type instanceof TNamedObject && ($type->value === 'static' || $type->was_static)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3799,6 +3799,33 @@ class ClassTemplateTest extends TestCase
|
||||
}
|
||||
}',
|
||||
],
|
||||
'static is the return type of an analyzed static method' => [
|
||||
'<?php
|
||||
|
||||
abstract class A
|
||||
{
|
||||
}
|
||||
|
||||
final class B extends A
|
||||
{
|
||||
public static function create(): static
|
||||
{
|
||||
return new self();
|
||||
}
|
||||
}
|
||||
|
||||
final class Service
|
||||
{
|
||||
public function do(): void
|
||||
{
|
||||
$this->acceptA(B::create());
|
||||
}
|
||||
|
||||
private function acceptA(A $_a): void
|
||||
{
|
||||
}
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user