From: vrana Date: Fri, 5 Oct 2012 23:32:06 +0000 (-0700) Subject: Decrease severity of preg_quote() warning X-Git-Tag: conduit-6~94 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=d0ed67ab1dcaaa6c28df7ae4ebc06fc6640683bc;p=arcanist.git Decrease severity of preg_quote() warning 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 --- diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php index 8f230670..28010688 100644 --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -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.'); } } } diff --git a/src/lint/linter/__tests__/xhpast/preg-quote.lint-test b/src/lint/linter/__tests__/xhpast/preg-quote.lint-test index 66b3a275..fe0f81e5 100644 --- a/src/lint/linter/__tests__/xhpast/preg-quote.lint-test +++ b/src/lint/linter/__tests__/xhpast/preg-quote.lint-test @@ -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()