Page MenuHomePhabricator

D17232.id41463.diff
No OneTemporary

D17232.id41463.diff

diff --git a/src/lint/linter/__tests__/jshint/jshint.lint-test b/src/lint/linter/__tests__/jshint/jshint.lint-test
--- a/src/lint/linter/__tests__/jshint/jshint.lint-test
+++ b/src/lint/linter/__tests__/jshint/jshint.lint-test
@@ -9,4 +9,4 @@
~~~~~~~~~~
warning:3:8
error:7:1
-error:9:
+error:9:1
diff --git a/src/lint/linter/xhpast/rules/ArcanistDeprecationXHPASTLinterRule.php b/src/lint/linter/xhpast/rules/ArcanistDeprecationXHPASTLinterRule.php
--- a/src/lint/linter/xhpast/rules/ArcanistDeprecationXHPASTLinterRule.php
+++ b/src/lint/linter/xhpast/rules/ArcanistDeprecationXHPASTLinterRule.php
@@ -37,15 +37,17 @@
}
public function process(XHPASTNode $root) {
- $map = $this->deprecatedFunctions;
- $function_calls = $this->getFunctionCalls($root, array_keys($map));
+ $function_names = array_map(
+ 'strtolower', array_keys($this->deprecatedFunctions));
+ $map = new CaseInsensitiveArray($this->deprecatedFunctions);
+
+ $function_calls = $this->getFunctionCalls($root, $function_names);
foreach ($function_calls as $call) {
$name = $call
->getChildByIndex(0)
->getConcreteString();
- $name = strtolower($name);
if (empty($map[$name])) {
continue;
}
diff --git a/src/lint/linter/xhpast/rules/__tests__/deprecation/deprecated-function.lint-test b/src/lint/linter/xhpast/rules/__tests__/deprecation/deprecated-function.lint-test
--- a/src/lint/linter/xhpast/rules/__tests__/deprecation/deprecated-function.lint-test
+++ b/src/lint/linter/xhpast/rules/__tests__/deprecation/deprecated-function.lint-test
@@ -1,6 +1,6 @@
<?php
-deprecated_function();
+deprecatedfunction();
modern_function();
~~~~~~~~~~
warning:3:1
@@ -9,7 +9,7 @@
{
"config": {
"xhpast.deprecated.functions": {
- "deprecated_function": "This function is deprecated."
+ "DeprecatedFunction": "This function is deprecated."
}
}
}
diff --git a/src/lint/linter/xhpast/rules/__tests__/deprecation/deprecated-static-method.lint-test b/src/lint/linter/xhpast/rules/__tests__/deprecation/deprecated-static-method.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/xhpast/rules/__tests__/deprecation/deprecated-static-method.lint-test
@@ -0,0 +1,15 @@
+<?php
+
+MyLib::deprecatedmethod();
+MyLib::nonDeprecatedMethod();
+~~~~~~~~~~
+warning:3:1
+~~~~~~~~~~
+~~~~~~~~~~
+{
+ "config": {
+ "xhpast.deprecated.functions": {
+ "MyLib::deprecatedMethod": "This static method is deprecated."
+ }
+ }
+}

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 13, 6:43 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7724964
Default Alt Text
D17232.id41463.diff (2 KB)

Event Timeline