Summary:
The `ArcanistXHPASTLinter::LINT_TOSTRING_EXCEPTION` linter rule was introduced in D12854, but fails for the following:
- Interfaces which declare the `__toString()` method.
- Classes which mark the `__toString()` method as `abstract`.
Test Plan: Added test cases.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D12892
continue;
}
- $throws = $method
- ->getChildOfType(5, 'n_STATEMENT_LIST')
- ->selectDescendantsOfType('n_THROW');
+ $statements = $method->getChildByIndex(5);
+
+ if ($statements->getTypeName() != 'n_STATEMENT_LIST') {
+ continue;
+ }
+
+ $throws = $statements->selectDescendantsOfType('n_THROW');
foreach ($throws as $throw) {
$this->raiseLintAtNode(
return 'Success';
}
}
+
+interface SomeInterface {
+ public function __toString();
+}
+
+abstract class SomeAbstractClass {
+ abstract public function __toString();
+}
~~~~~~~~~~
error:5:7