Differential D14513 Diff 35118 src/lint/linter/xhpast/rules/ArcanistNestedNamespacesXHPASTLinterRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/rules/ArcanistNestedNamespacesXHPASTLinterRule.php
- This file was added.
<?php | |||||
final class ArcanistNestedNamespacesXHPASTLinterRule | |||||
extends ArcanistXHPASTLinterRule { | |||||
const ID = 90; | |||||
public function getLintName() { | |||||
return pht('Nested `%s` Statements', 'namespace'); | |||||
} | |||||
public function process(XHPASTNode $root) { | |||||
$namespaces = $root->selectDescendantsOfType('n_NAMESPACE'); | |||||
foreach ($namespaces as $namespace) { | |||||
$nested_namespaces = $namespace->selectDescendantsOfType('n_NAMESPACE'); | |||||
foreach ($nested_namespaces as $nested_namespace) { | |||||
$this->raiseLintAtNode( | |||||
$nested_namespace, | |||||
pht( | |||||
'`%s` declarations cannot be nested. '. | |||||
'This construct will cause a PHP fatal error.', | |||||
'namespace')); | |||||
} | |||||
} | |||||
} | |||||
} |