Page MenuHomePhabricator

D17232.id41445.diff
No OneTemporary

D17232.id41445.diff

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
@@ -28,7 +28,10 @@
public function setLinterConfigurationValue($key, $value) {
switch ($key) {
case 'xhpast.deprecated.functions':
- $this->deprecatedFunctions = $value;
+ $this->deprecatedFunctions = array();
+ foreach ($value as $name => $message) {
+ $this->deprecatedFunctions[strtolower($name)] = $message;
+ }
return;
default:
@@ -38,6 +41,7 @@
public function process(XHPASTNode $root) {
$map = $this->deprecatedFunctions;
+
$function_calls = $this->getFunctionCalls($root, array_keys($map));
foreach ($function_calls as $call) {
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
Fri, Dec 13, 10:58 AM (5 h, 6 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6873516
Default Alt Text
D17232.id41445.diff (2 KB)

Event Timeline