Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13964011
D10467.id25171.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
D10467.id25171.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
@@ -384,9 +384,15 @@
continue;
}
- $function_name = $function
- ->getChildOfType(0, 'n_SYMBOL_NAME')
- ->getConcreteString();
+ $function_token = $function
+ ->getChildByIndex(0);
+
+ if ($function_token->getTypeName() != 'n_SYMBOL_NAME') {
+ // This may be `Class::method(...)` or `$var(...)`.
+ continue;
+ }
+
+ $function_name = $function_token->getConcreteString();
switch ($function_name) {
case 'class_exists':
diff --git a/src/lint/linter/__tests__/xhpast/conditional-usage.lint-test b/src/lint/linter/__tests__/xhpast/conditional-usage.lint-test
--- a/src/lint/linter/__tests__/xhpast/conditional-usage.lint-test
+++ b/src/lint/linter/__tests__/xhpast/conditional-usage.lint-test
@@ -11,6 +11,11 @@
new CURLFile('');
new DateTimeImmutable();
}
+
+// These shouldn't fatal.
+if (SomeClass::someStaticMethod($param)) {}
+$var = 'some_func';
+if ($var()) {}
~~~~~~~~~~
error:5:3
error:7:3
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 16, 7:14 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6718756
Default Alt Text
D10467.id25171.diff (1 KB)
Attached To
Mode
D10467: Fix PHP version check for function calls with static/variable functions
Attached
Detach File
Event Timeline
Log In to Comment