mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
Fix the ArcanistXHPASTLinter
single quote rule.
Summary: Previously, the `ArcanistXHPASTLinter` was suggesting that `"\1"` be written as `'\1'`, which is incorrect. Therefore, I ensured that all of the cases listed in the [[http://www.php.net/manual/en/language.types.string.php | PHP documentation]] were handled correctly. Test Plan: `arc unit` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9182
This commit is contained in:
parent
b21a420071
commit
178b32c6c2
2 changed files with 17 additions and 4 deletions
|
@ -2389,15 +2389,22 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
|||
// Double quoted strings are allowed when the string contains the
|
||||
// following characters.
|
||||
static $allowed_chars = array(
|
||||
'\0',
|
||||
'\n',
|
||||
'\r',
|
||||
'\f',
|
||||
'\t',
|
||||
'\v',
|
||||
'\x',
|
||||
'\b',
|
||||
'\e',
|
||||
'\f',
|
||||
'\'',
|
||||
'\0',
|
||||
'\1',
|
||||
'\2',
|
||||
'\3',
|
||||
'\4',
|
||||
'\5',
|
||||
'\6',
|
||||
'\7',
|
||||
'\x',
|
||||
);
|
||||
|
||||
$contains_special_chars = false;
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
pht(
|
||||
"This string requires \x12\x34 double quotes, but ".
|
||||
"this string does not. Here, they are used for consistency.");
|
||||
pht(
|
||||
"This string also requires \123\345 double quotes, but ".
|
||||
"this string does not. Here, they are used for consistency.");
|
||||
~~~~~~~~~~
|
||||
advice:3:1
|
||||
~~~~~~~~~~
|
||||
|
@ -21,3 +24,6 @@ advice:3:1
|
|||
pht(
|
||||
"This string requires \x12\x34 double quotes, but ".
|
||||
"this string does not. Here, they are used for consistency.");
|
||||
pht(
|
||||
"This string also requires \123\345 double quotes, but ".
|
||||
"this string does not. Here, they are used for consistency.");
|
||||
|
|
Loading…
Reference in a new issue