Summary: D10132 improved this check by eliminating some false postives, but assumes an `n_FUNCTION_CALL` always starts with `n_SYMBOL_NAME`. This is true for `f()`, but not true for `C::m()` or `$v()`.
Test Plan: Added and ran unit tests.
Reviewers: btrahan, joshuaspence
Reviewed By: joshuaspence
Subscribers: epriestley
Differential Revision: https://secure.phabricator.com/D10467
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':
new CURLFile('');
new DateTimeImmutable();
}
+
+// These shouldn't fatal.
+if (SomeClass::someStaticMethod($param)) {}
+$var = 'some_func';
+if ($var()) {}
~~~~~~~~~~
error:5:3
error:7:3