Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14095026
D12892.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.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 26, 7:20 PM (21 h, 33 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6790585
Default Alt Text
D12892.diff (1 KB)
Attached To
Mode
D12892: Improve ArcanistXHPASTLinter::LINT_TOSTRING_EXCEPTION
Attached
Detach File
Event Timeline
Log In to Comment