Page MenuHomePhabricator

D12892.id.diff
No OneTemporary

D12892.id.diff

diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php
--- a/src/lint/linter/ArcanistXHPASTLinter.php
+++ b/src/lint/linter/ArcanistXHPASTLinter.php
@@ -4144,9 +4144,13 @@
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(
diff --git a/src/lint/linter/__tests__/xhpast/tostring-exception.lint-test b/src/lint/linter/__tests__/xhpast/tostring-exception.lint-test
--- a/src/lint/linter/__tests__/xhpast/tostring-exception.lint-test
+++ b/src/lint/linter/__tests__/xhpast/tostring-exception.lint-test
@@ -14,5 +14,13 @@
return 'Success';
}
}
+
+interface SomeInterface {
+ public function __toString();
+}
+
+abstract class SomeAbstractClass {
+ abstract public function __toString();
+}
~~~~~~~~~~
error:5:7

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 5, 11:46 AM (1 w, 14 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6731243
Default Alt Text
D12892.id.diff (1 KB)

Event Timeline