Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14016943
D12892.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12892.id.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D12892: Improve ArcanistXHPASTLinter::LINT_TOSTRING_EXCEPTION
Attached
Detach File
Event Timeline
Log In to Comment