Fix NameResolver for class constant native type

This commit is contained in:
Ondrej Mirtes 2023-11-28 14:15:16 +01:00 committed by Nikita Popov
parent d0b35126e7
commit f66650073c
2 changed files with 11 additions and 1 deletions

View File

@ -115,6 +115,9 @@ class NameResolver extends NodeVisitorAbstract {
$this->addNamespacedName($const);
}
} elseif ($node instanceof Stmt\ClassConst) {
if (null !== $node->type) {
$node->type = $this->resolveType($node->type);
}
$this->resolveAttrGroups($node);
} elseif ($node instanceof Stmt\EnumCase) {
$this->resolveAttrGroups($node);

View File

@ -188,7 +188,7 @@ class A extends B implements C, D {
E::h as i;
E::j insteadof F, G;
}
#[X]
public float $php = 7.4;
public ?Foo $person;
@ -197,6 +197,10 @@ class A extends B implements C, D {
#[X]
const C = 1;
public const X A = X::Bar;
public const X\Foo B = X\Foo::Bar;
public const \X\Foo C = \X\Foo::Bar;
}
#[X]
@ -262,6 +266,9 @@ class A extends \NS\B implements \NS\C, \NS\D
public \NS\A|\NS\B|int $prop;
#[\NS\X]
const C = 1;
public const \NS\X A = \NS\X::Bar;
public const \NS\X\Foo B = \NS\X\Foo::Bar;
public const \X\Foo C = \X\Foo::Bar;
}
#[\NS\X]
interface A extends \NS\C, \NS\D