Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/ArcanistXHPASTLinterRule.php
| Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | /* -( Utility )------------------------------------------------------------ */ | ||||
| * @param XHPASTNode Root node. | * @param XHPASTNode Root node. | ||||
| * @param list<string> Function names. | * @param list<string> Function names. | ||||
| * @return AASTNodeList | * @return AASTNodeList | ||||
| */ | */ | ||||
| protected function getFunctionCalls(XHPASTNode $root, array $function_names) { | protected function getFunctionCalls(XHPASTNode $root, array $function_names) { | ||||
| $calls = $root->selectDescendantsOfType('n_FUNCTION_CALL'); | $calls = $root->selectDescendantsOfType('n_FUNCTION_CALL'); | ||||
| $nodes = array(); | $nodes = array(); | ||||
| $function_names = array_map('strtolower', $function_names); | |||||
| foreach ($calls as $call) { | foreach ($calls as $call) { | ||||
| $node = $call->getChildByIndex(0); | $node = $call->getChildByIndex(0); | ||||
| $name = strtolower($node->getConcreteString()); | $name = strtolower($node->getConcreteString()); | ||||
| if (in_array($name, $function_names)) { | if (in_array($name, $function_names)) { | ||||
| $nodes[] = $call; | $nodes[] = $call; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines | |||||