fix property / constant ancestor check
parent
21cee77624
commit
b02c164c2b
|
@ -1095,7 +1095,11 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
|
||||||
// }
|
// }
|
||||||
else if ($node instanceof Tolerant\Node\MethodDeclaration) {
|
else if ($node instanceof Tolerant\Node\MethodDeclaration) {
|
||||||
// Class method: use ClassName->methodName() as name
|
// Class method: use ClassName->methodName() as name
|
||||||
$class = $node->getFirstAncestor(Tolerant\Node\Statement\ClassDeclaration::class, Tolerant\Node\Statement\TraitDeclaration::class, Tolerant\Node\Statement\InterfaceDeclaration::class);
|
$class = $node->getFirstAncestor(
|
||||||
|
Tolerant\Node\Statement\ClassDeclaration::class,
|
||||||
|
Tolerant\Node\Statement\InterfaceDeclaration::class,
|
||||||
|
Tolerant\Node\Statement\TraitDeclaration::class
|
||||||
|
);
|
||||||
if (!isset($class->name)) {
|
if (!isset($class->name)) {
|
||||||
// Ignore anonymous classes
|
// Ignore anonymous classes
|
||||||
return null;
|
return null;
|
||||||
|
@ -1117,7 +1121,11 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
|
||||||
$node instanceof Tolerant\Node\Expression\Variable &&
|
$node instanceof Tolerant\Node\Expression\Variable &&
|
||||||
($propertyDeclaration = $node->getFirstAncestor(Tolerant\Node\PropertyDeclaration::class)) !== null &&
|
($propertyDeclaration = $node->getFirstAncestor(Tolerant\Node\PropertyDeclaration::class)) !== null &&
|
||||||
($classDeclaration =
|
($classDeclaration =
|
||||||
$node->getFirstAncestor(Tolerant\Node\Statement\ClassDeclaration::class, Tolerant\Node\Statement\InterfaceDeclaration::class, Tolerant\Node\Statement\TraitDeclaration::class)
|
$node->getFirstAncestor(
|
||||||
|
Tolerant\Node\Statement\ClassDeclaration::class,
|
||||||
|
Tolerant\Node\Statement\InterfaceDeclaration::class,
|
||||||
|
Tolerant\Node\Statement\TraitDeclaration::class
|
||||||
|
)
|
||||||
) !== null)
|
) !== null)
|
||||||
{
|
{
|
||||||
if ($propertyDeclaration->isStatic()) {
|
if ($propertyDeclaration->isStatic()) {
|
||||||
|
@ -1143,7 +1151,11 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
|
||||||
}
|
}
|
||||||
if ($constDeclaration instanceof Tolerant\Node\ClassConstDeclaration) {
|
if ($constDeclaration instanceof Tolerant\Node\ClassConstDeclaration) {
|
||||||
// Class constant: use ClassName::CONSTANT_NAME as name
|
// Class constant: use ClassName::CONSTANT_NAME as name
|
||||||
$classDeclaration = $constDeclaration->getFirstAncestor(Tolerant\Node\Statement\ClassDeclaration::class);
|
$classDeclaration = $constDeclaration->getFirstAncestor(
|
||||||
|
Tolerant\Node\Statement\ClassDeclaration::class,
|
||||||
|
Tolerant\Node\Statement\InterfaceDeclaration::class,
|
||||||
|
Tolerant\Node\Statement\TraitDeclaration::class
|
||||||
|
);
|
||||||
if (!isset($classDeclaration->name)) {
|
if (!isset($classDeclaration->name)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue