Differential D19741 Diff 47163 src/lint/linter/xhpast/rules/ArcanistClassNameLiteralXHPASTLinterRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/rules/ArcanistClassNameLiteralXHPASTLinterRule.php
| Show All 11 Lines | final class ArcanistClassNameLiteralXHPASTLinterRule | ||||
| public function getLintSeverity() { | public function getLintSeverity() { | ||||
| return ArcanistLintSeverity::SEVERITY_ADVICE; | return ArcanistLintSeverity::SEVERITY_ADVICE; | ||||
| } | } | ||||
| public function process(XHPASTNode $root) { | public function process(XHPASTNode $root) { | ||||
| $class_declarations = $root->selectDescendantsOfType('n_CLASS_DECLARATION'); | $class_declarations = $root->selectDescendantsOfType('n_CLASS_DECLARATION'); | ||||
| foreach ($class_declarations as $class_declaration) { | foreach ($class_declarations as $class_declaration) { | ||||
| if ($class_declaration->getChildByIndex(1)->getTypeName() == 'n_EMPTY') { | |||||
| continue; | |||||
| } | |||||
| $class_name = $class_declaration | $class_name = $class_declaration | ||||
| ->getChildOfType(1, 'n_CLASS_NAME') | ->getChildOfType(1, 'n_CLASS_NAME') | ||||
| ->getConcreteString(); | ->getConcreteString(); | ||||
| $strings = $class_declaration->selectDescendantsOfType('n_STRING_SCALAR'); | $strings = $class_declaration->selectDescendantsOfType('n_STRING_SCALAR'); | ||||
| foreach ($strings as $string) { | foreach ($strings as $string) { | ||||
| $contents = substr($string->getSemanticString(), 1, -1); | $contents = substr($string->getSemanticString(), 1, -1); | ||||
| Show All 22 Lines | |||||