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
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(
$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(
$vars[] = $var;
}
- $body = $def->getChildByIndex(5);
+ $body = $def->getChildByIndex(6);
if ($body->getTypeName() === 'n_EMPTY') {
// Abstract method declaration.
continue;
));
foreach ($defs as $def) {
- $body = $def->getChildByIndex(5);
+ $body = $def->getChildByIndex(6);
if ($body->getTypeName() === 'n_EMPTY') {
// Abstract method declaration.
continue;
continue;
}
- $body = $method->getChildOfType(5, 'n_STATEMENT_LIST');
+ $body = $method->getChildOfType(6, 'n_STATEMENT_LIST');
$variables = $body->selectDescendantsOfType('n_VARIABLE');
foreach ($variables as $variable) {
continue;
}
- $statements = $method->getChildByIndex(5);
+ $statements = $method->getChildByIndex(6);
if ($statements->getTypeName() != 'n_STATEMENT_LIST') {
continue;
$vars[] = $var;
}
- $body = $def->getChildByIndex(5);
+ $body = $def->getChildByIndex(6);
if ($body->getTypeName() === 'n_EMPTY') {
// Abstract method declaration.
continue;
$parameters[] = $parameter->getConcreteString();
}
- $statements = $method->getChildByIndex(5);
+ $statements = $method->getChildByIndex(6);
if ($statements->getTypeName() != 'n_STATEMENT_LIST') {
continue;