mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
Update xhpast linter rules for new function AST format
Summary: See D15678. A node containing a return type hint is added right before the statement body node. This updates all relevant linter rules to now retrieve the body from the correct index. Test Plan: Ran `arc unit --everything`, inspected every single message to make sure all xhpast test cases succeeded. Also grepped for `getChildByIndex(5` and `getChildOfType(5`. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D15814
This commit is contained in:
parent
ea6fc77892
commit
3ffed59bd7
8 changed files with 8 additions and 8 deletions
|
@ -14,7 +14,7 @@ final class ArcanistAbstractMethodBodyXHPASTLinterRule
|
|||
|
||||
foreach ($methods as $method) {
|
||||
$modifiers = $this->getModifiers($method);
|
||||
$body = $method->getChildByIndex(5);
|
||||
$body = $method->getChildByIndex(6);
|
||||
|
||||
if (idx($modifiers, 'abstract') && $body->getTypeName() != 'n_EMPTY') {
|
||||
$this->raiseLintAtNode(
|
||||
|
|
|
@ -16,7 +16,7 @@ final class ArcanistInterfaceMethodBodyXHPASTLinterRule
|
|||
$methods = $interface->selectDescendantsOfType('n_METHOD_DECLARATION');
|
||||
|
||||
foreach ($methods as $method) {
|
||||
$body = $method->getChildByIndex(5);
|
||||
$body = $method->getChildByIndex(6);
|
||||
|
||||
if ($body->getTypeName() != 'n_EMPTY') {
|
||||
$this->raiseLintAtNode(
|
||||
|
|
|
@ -46,7 +46,7 @@ final class ArcanistReusedAsIteratorXHPASTLinterRule
|
|||
$vars[] = $var;
|
||||
}
|
||||
|
||||
$body = $def->getChildByIndex(5);
|
||||
$body = $def->getChildByIndex(6);
|
||||
if ($body->getTypeName() === 'n_EMPTY') {
|
||||
// Abstract method declaration.
|
||||
continue;
|
||||
|
|
|
@ -31,7 +31,7 @@ final class ArcanistReusedIteratorReferenceXHPASTLinterRule
|
|||
));
|
||||
|
||||
foreach ($defs as $def) {
|
||||
$body = $def->getChildByIndex(5);
|
||||
$body = $def->getChildByIndex(6);
|
||||
if ($body->getTypeName() === 'n_EMPTY') {
|
||||
// Abstract method declaration.
|
||||
continue;
|
||||
|
|
|
@ -40,7 +40,7 @@ final class ArcanistStaticThisXHPASTLinterRule
|
|||
continue;
|
||||
}
|
||||
|
||||
$body = $method->getChildOfType(5, 'n_STATEMENT_LIST');
|
||||
$body = $method->getChildOfType(6, 'n_STATEMENT_LIST');
|
||||
$variables = $body->selectDescendantsOfType('n_VARIABLE');
|
||||
|
||||
foreach ($variables as $variable) {
|
||||
|
|
|
@ -21,7 +21,7 @@ final class ArcanistToStringExceptionXHPASTLinterRule
|
|||
continue;
|
||||
}
|
||||
|
||||
$statements = $method->getChildByIndex(5);
|
||||
$statements = $method->getChildByIndex(6);
|
||||
|
||||
if ($statements->getTypeName() != 'n_STATEMENT_LIST') {
|
||||
continue;
|
||||
|
|
|
@ -88,7 +88,7 @@ final class ArcanistUndeclaredVariableXHPASTLinterRule
|
|||
$vars[] = $var;
|
||||
}
|
||||
|
||||
$body = $def->getChildByIndex(5);
|
||||
$body = $def->getChildByIndex(6);
|
||||
if ($body->getTypeName() === 'n_EMPTY') {
|
||||
// Abstract method declaration.
|
||||
continue;
|
||||
|
|
|
@ -40,7 +40,7 @@ final class ArcanistUselessOverridingMethodXHPASTLinterRule
|
|||
$parameters[] = $parameter->getConcreteString();
|
||||
}
|
||||
|
||||
$statements = $method->getChildByIndex(5);
|
||||
$statements = $method->getChildByIndex(6);
|
||||
|
||||
if ($statements->getTypeName() != 'n_STATEMENT_LIST') {
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue