mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-23 22:10:54 +01:00
Replace preg_quote() lint error by warning
Summary: See http://php.net/regexp.reference.delimiters Test Plan: arc lint on a file with preg_quote() with one parameter Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley, vrana Differential Revision: https://secure.phabricator.com/D1163
This commit is contained in:
parent
6910fd77a4
commit
7af16f42cd
2 changed files with 7 additions and 4 deletions
|
@ -91,6 +91,8 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
|
||||||
=> ArcanistLintSeverity::SEVERITY_WARNING,
|
=> ArcanistLintSeverity::SEVERITY_WARNING,
|
||||||
self::LINT_NAMING_CONVENTIONS
|
self::LINT_NAMING_CONVENTIONS
|
||||||
=> ArcanistLintSeverity::SEVERITY_WARNING,
|
=> ArcanistLintSeverity::SEVERITY_WARNING,
|
||||||
|
self::LINT_PREG_QUOTE_MISUSE
|
||||||
|
=> ArcanistLintSeverity::SEVERITY_WARNING,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,8 +1056,9 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* preg_quote() takes two arguments, but the second one is optional because
|
* preg_quote() takes two arguments, but the second one is optional because
|
||||||
* PHP is awesome. If you don't pass a second argument, you're probably
|
* it is possible to use (), [] or {} as regular expression delimiters. If
|
||||||
* going to get something wrong.
|
* you don't pass a second argument, you're probably going to get something
|
||||||
|
* wrong.
|
||||||
*/
|
*/
|
||||||
protected function lintPregQuote($root) {
|
protected function lintPregQuote($root) {
|
||||||
$function_calls = $root->selectDescendantsOfType('n_FUNCTION_CALL');
|
$function_calls = $root->selectDescendantsOfType('n_FUNCTION_CALL');
|
||||||
|
|
|
@ -8,5 +8,5 @@ function foo($bar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:4:3 Wrong number of arguments to preg_quote()
|
warning:4:3 Wrong number of arguments to preg_quote()
|
||||||
error:6:3 Wrong number of arguments to preg_quote()
|
warning:6:3 Wrong number of arguments to preg_quote()
|
||||||
|
|
Loading…
Reference in a new issue