Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistXHPASTLinter.php
| Show First 20 Lines • Show All 1,896 Lines • ▼ Show 20 Lines | foreach ($defs as $def) { | ||||
| // their declaration if they're invalid and they may not conform to | // their declaration if they're invalid and they may not conform to | ||||
| // variable rules. This is slightly overbroad (includes the entire | // variable rules. This is slightly overbroad (includes the entire | ||||
| // rhs of a "Class::..." token) to cover cases like "Class:$x[0]". These | // rhs of a "Class::..." token) to cover cases like "Class:$x[0]". These | ||||
| // variables are simply made exempt from naming conventions. | // variables are simply made exempt from naming conventions. | ||||
| $exclude_tokens = array(); | $exclude_tokens = array(); | ||||
| $statics = $def->selectDescendantsOfType('n_CLASS_STATIC_ACCESS'); | $statics = $def->selectDescendantsOfType('n_CLASS_STATIC_ACCESS'); | ||||
| foreach ($statics as $static) { | foreach ($statics as $static) { | ||||
| $rhs = $static->getChildByIndex(1); | $rhs = $static->getChildByIndex(1); | ||||
| $rhs_vars = $def->selectDescendantsOfType('n_VARIABLE'); | if ($rhs->getTypeName() == 'n_VARIABLE') { | ||||
| $exclude_tokens[$rhs->getID()] = true; | |||||
| } else { | |||||
| $rhs_vars = $rhs->selectDescendantsOfType('n_VARIABLE'); | |||||
| foreach ($rhs_vars as $var) { | foreach ($rhs_vars as $var) { | ||||
| $exclude_tokens[$var->getID()] = true; | $exclude_tokens[$var->getID()] = true; | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| $vars = $def->selectDescendantsOfType('n_VARIABLE'); | $vars = $def->selectDescendantsOfType('n_VARIABLE'); | ||||
| foreach ($vars as $token_id => $var) { | foreach ($vars as $token_id => $var) { | ||||
| if (isset($member_tokens[$token_id])) { | if (isset($member_tokens[$token_id])) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (isset($param_tokens[$token_id])) { | if (isset($param_tokens[$token_id])) { | ||||
| continue; | continue; | ||||
| ▲ Show 20 Lines • Show All 964 Lines • Show Last 20 Lines | |||||