]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Decrease severity of preg_quote() warning
authorvrana <jakubv@fb.com>
Fri, 5 Oct 2012 23:32:06 +0000 (16:32 -0700)
committervrana <jakubv@fb.com>
Sat, 6 Oct 2012 01:05:11 +0000 (18:05 -0700)
Summary: I use it more often without second parameter than with it.

Test Plan:
Lint of:

  preg_quote('');
  preg_quote('', '/');

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3647

src/lint/linter/ArcanistXHPASTLinter.php
src/lint/linter/__tests__/xhpast/preg-quote.lint-test

index 8f2306705edb9c1becbe069a06fa3edda28795b0..28010688dce5be1cb50c8dbe6d973d651d59dcd2 100644 (file)
@@ -114,7 +114,7 @@ final class ArcanistXHPASTLinter extends ArcanistLinter {
       self::LINT_NAMING_CONVENTIONS
         => ArcanistLintSeverity::SEVERITY_WARNING,
       self::LINT_PREG_QUOTE_MISUSE
-        => ArcanistLintSeverity::SEVERITY_WARNING,
+        => ArcanistLintSeverity::SEVERITY_ADVICE,
       self::LINT_BRACE_FORMATTING
         => ArcanistLintSeverity::SEVERITY_WARNING,
       self::LINT_PARENTHESES_SPACING
@@ -1772,8 +1772,9 @@ final class ArcanistXHPASTLinter extends ArcanistLinter {
           $this->raiseLintAtNode(
             $call,
             self::LINT_PREG_QUOTE_MISUSE,
-            'You should always pass two arguments to preg_quote(), so that ' .
-            'preg_quote() knows which delimiter to escape.');
+            'If you use pattern delimiters that require escaping (such as //, '.
+            'but not ()) then you should pass two arguments to preg_quote(), '.
+            'so that preg_quote() knows which delimiter to escape.');
         }
       }
     }
index 66b3a2751eb7064101701360ea3606f1ffa996cf..fe0f81e5d17000b0abd89e7c44da6ad747766d02 100644 (file)
@@ -8,5 +8,5 @@ function foo($bar) {
 }
 
 ~~~~~~~~~~
-warning:4:3 Wrong number of arguments to preg_quote()
-warning:6:3 Wrong number of arguments to preg_quote()
+advice:4:3 Wrong number of arguments to preg_quote()
+advice:6:3 Wrong number of arguments to preg_quote()