]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Improve the robustness of the "alias function" linter rule
authorJoshua Spence <josh@joshuaspence.com>
Tue, 19 May 2015 22:36:12 +0000 (08:36 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Tue, 19 May 2015 22:36:36 +0000 (08:36 +1000)
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
src/lint/linter/__tests__/xhpast/alias-functions.lint-test

index 5cff66d78bfdec7c4fe36b2efc9bb9c04afeaff2..cd9744deb431181d1ac8fa089bdeb32cc644e1e2 100644 (file)
@@ -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())]);
     }
   }
 
index 0ef8700667a8f0a0d999ed4c8162a8d01f3eae9e..d2834524d6898a7d68fd82c363aa26647e743e99 100644 (file)
@@ -3,12 +3,15 @@
 $x = array();
 sizeof($x);
 die();
+sizeOf($x);
 ~~~~~~~~~~
 advice:4:1
 advice:5:1
+advice:6:1
 ~~~~~~~~~~
 <?php
 
 $x = array();
 count($x);
 exit();
+count($x);