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
$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
// keywords, it's exceedingly rare for anyone to type, e.g., "CLASS" or
// "cLaSs" in the wild. This list just attempts to cover unconventional
'false' => 'false',
'null' => 'null',
'array' => 'array',
+ 'new' => 'new',
);
foreach ($keywords as $keyword) {
function f(array $x, ArRaY $y) {
}
+
+new C();
+NeW C();
~~~~~~~~~~
warning:6:1
warning:7:1
warning:9:1
warning:11:1
warning:13:22
+warning:18:1
~~~~~~~~~~
<?php
function f(array $x, array $y) {
}
+
+new C();
+new C();