mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +01:00
Improve ArcanistXHPASTLinter::LINT_TOSTRING_EXCEPTION
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
This commit is contained in:
parent
2422202ba4
commit
8c6e1284cc
2 changed files with 15 additions and 3 deletions
|
@ -4144,9 +4144,13 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
|||
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(
|
||||
|
|
|
@ -14,5 +14,13 @@ class MyOtherClass {
|
|||
return 'Success';
|
||||
}
|
||||
}
|
||||
|
||||
interface SomeInterface {
|
||||
public function __toString();
|
||||
}
|
||||
|
||||
abstract class SomeAbstractClass {
|
||||
abstract public function __toString();
|
||||
}
|
||||
~~~~~~~~~~
|
||||
error:5:7
|
||||
|
|
Loading…
Reference in a new issue