diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index c4b3d8b1..70f87173 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -110,6 +110,7 @@ phutil_register_library_map(array( 'ArcanistGeneratedLinterTestCase' => 'lint/linter/__tests__/ArcanistGeneratedLinterTestCase.php', 'ArcanistGetConfigWorkflow' => 'workflow/ArcanistGetConfigWorkflow.php', 'ArcanistGitAPI' => 'repository/api/ArcanistGitAPI.php', + 'ArcanistGlobalVariableXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistGlobalVariableXHPASTLinterRule.php', 'ArcanistGoLintLinter' => 'lint/linter/ArcanistGoLintLinter.php', 'ArcanistGoLintLinterTestCase' => 'lint/linter/__tests__/ArcanistGoLintLinterTestCase.php', 'ArcanistGoTestResultParser' => 'unit/parser/ArcanistGoTestResultParser.php', @@ -390,6 +391,7 @@ phutil_register_library_map(array( 'ArcanistGeneratedLinterTestCase' => 'ArcanistLinterTestCase', 'ArcanistGetConfigWorkflow' => 'ArcanistWorkflow', 'ArcanistGitAPI' => 'ArcanistRepositoryAPI', + 'ArcanistGlobalVariableXHPASTLinterRule' => 'ArcanistXHPASTLinterRule', 'ArcanistGoLintLinter' => 'ArcanistExternalLinter', 'ArcanistGoLintLinterTestCase' => 'ArcanistExternalLinterTestCase', 'ArcanistGoTestResultParser' => 'ArcanistTestResultParser', diff --git a/src/lint/linter/__tests__/xhpast/global-variables.lint-test b/src/lint/linter/__tests__/xhpast/global-variables.lint-test new file mode 100644 index 00000000..863cf5fd --- /dev/null +++ b/src/lint/linter/__tests__/xhpast/global-variables.lint-test @@ -0,0 +1,8 @@ +selectDescendantsOfType('n_GLOBAL_DECLARATION_LIST'); + + foreach ($nodes as $node) { + $this->raiseLintAtNode( + $node, + pht( + 'Limit the use of global variables. Global variables are '. + 'generally a bad idea and should be avoided when possible.')); + } + } + +}