1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Correct capitalization of "new" in lint

Summary: Automatically correct `New` to `new` in lint.

Test Plan: Ran unit tests.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D6948
This commit is contained in:
epriestley 2013-09-12 13:01:25 -07:00
parent ba3c8e3356
commit c00d8c551c
2 changed files with 13 additions and 0 deletions

View file

@ -2287,6 +2287,11 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$keywords[] = head($typehint->getTokens()); $keywords[] = head($typehint->getTokens());
} }
$new_invocations = $root->selectDescendantsOfType('n_NEW');
foreach ($new_invocations as $invocation) {
$keywords[] = head($invocation->getTokens());
}
// NOTE: Although PHP generally allows arbitrary casing for all language // NOTE: Although PHP generally allows arbitrary casing for all language
// keywords, it's exceedingly rare for anyone to type, e.g., "CLASS" or // keywords, it's exceedingly rare for anyone to type, e.g., "CLASS" or
// "cLaSs" in the wild. This list just attempts to cover unconventional // "cLaSs" in the wild. This list just attempts to cover unconventional
@ -2299,6 +2304,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
'false' => 'false', 'false' => 'false',
'null' => 'null', 'null' => 'null',
'array' => 'array', 'array' => 'array',
'new' => 'new',
); );
foreach ($keywords as $keyword) { foreach ($keywords as $keyword) {

View file

@ -13,6 +13,9 @@ Array();
function f(array $x, ArRaY $y) { function f(array $x, ArRaY $y) {
} }
new C();
NeW C();
~~~~~~~~~~ ~~~~~~~~~~
warning:6:1 warning:6:1
warning:7:1 warning:7:1
@ -20,6 +23,7 @@ warning:8:1
warning:9:1 warning:9:1
warning:11:1 warning:11:1
warning:13:22 warning:13:22
warning:18:1
~~~~~~~~~~ ~~~~~~~~~~
<?php <?php
@ -36,3 +40,6 @@ array();
function f(array $x, array $y) { function f(array $x, array $y) {
} }
new C();
new C();