From 9444072e2161a132f18815dca2136750ad10c976 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Wed, 20 May 2015 08:36:12 +1000 Subject: [PATCH] Improve the robustness of the "alias function" linter rule Summary: Improve the `ArcanistXHPASTLinter::LINT_ALIAS_FUNCTION` linter rule. Currently this rule does not correctly handle alias functions which are not strictly lowercase. Test Plan: Added a test case. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12921 --- src/lint/linter/ArcanistXHPASTLinter.php | 2 +- src/lint/linter/__tests__/xhpast/alias-functions.lint-test | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php index 5cff66d7..cd9744de 100644 --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -4133,7 +4133,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter { $function_name, self::LINT_ALIAS_FUNCTION, pht('Alias functions should be avoided.'), - $aliases[$function_name->getConcreteString()]); + $aliases[phutil_utf8_strtolower($function_name->getConcreteString())]); } } diff --git a/src/lint/linter/__tests__/xhpast/alias-functions.lint-test b/src/lint/linter/__tests__/xhpast/alias-functions.lint-test index 0ef87006..d2834524 100644 --- a/src/lint/linter/__tests__/xhpast/alias-functions.lint-test +++ b/src/lint/linter/__tests__/xhpast/alias-functions.lint-test @@ -3,12 +3,15 @@ $x = array(); sizeof($x); die(); +sizeOf($x); ~~~~~~~~~~ advice:4:1 advice:5:1 +advice:6:1 ~~~~~~~~~~