Differential D19741 Diff 47163 src/lint/linter/xhpast/rules/ArcanistUnnecessaryFinalModifierXHPASTLinterRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/rules/ArcanistUnnecessaryFinalModifierXHPASTLinterRule.php
| Show All 11 Lines | final class ArcanistUnnecessaryFinalModifierXHPASTLinterRule | ||||
| public function getLintSeverity() { | public function getLintSeverity() { | ||||
| return ArcanistLintSeverity::SEVERITY_ADVICE; | return ArcanistLintSeverity::SEVERITY_ADVICE; | ||||
| } | } | ||||
| public function process(XHPASTNode $root) { | public function process(XHPASTNode $root) { | ||||
| $classes = $root->selectDescendantsOfType('n_CLASS_DECLARATION'); | $classes = $root->selectDescendantsOfType('n_CLASS_DECLARATION'); | ||||
| foreach ($classes as $class) { | foreach ($classes as $class) { | ||||
| if ($class->getChildByIndex(0)->getTypeName() == 'n_EMPTY') { | |||||
| continue; | |||||
| } | |||||
| $attributes = $class->getChildOfType(0, 'n_CLASS_ATTRIBUTES'); | $attributes = $class->getChildOfType(0, 'n_CLASS_ATTRIBUTES'); | ||||
| $is_final = false; | $is_final = false; | ||||
| foreach ($attributes->getChildren() as $attribute) { | foreach ($attributes->getChildren() as $attribute) { | ||||
| if ($attribute->getConcreteString() == 'final') { | if ($attribute->getConcreteString() == 'final') { | ||||
| $is_final = true; | $is_final = true; | ||||
| break; | break; | ||||
| } | } | ||||
| Show All 25 Lines | |||||