mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 08:12:40 +01:00
Allow new self
in linter
Summary: Also allow `sTaTiC::$x` which is a valid PHP (contrary to `sElF::$x` which is invalid PHP but I allowed that too). Test Plan: new self; Reviewers: epriestley Reviewed By: epriestley CC: wez, aran, Korvin Differential Revision: https://secure.phabricator.com/D5241
This commit is contained in:
parent
64bbcda431
commit
901f12dcb9
1 changed files with 11 additions and 6 deletions
|
@ -237,6 +237,12 @@ foreach ($classes as $class) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$magic_names = array(
|
||||||
|
'static' => true,
|
||||||
|
'parent' => true,
|
||||||
|
'self' => true,
|
||||||
|
);
|
||||||
|
|
||||||
// This is "new X()".
|
// This is "new X()".
|
||||||
$uses_of_new = $root->selectDescendantsOfType('n_NEW');
|
$uses_of_new = $root->selectDescendantsOfType('n_NEW');
|
||||||
foreach ($uses_of_new as $new_operator) {
|
foreach ($uses_of_new as $new_operator) {
|
||||||
|
@ -245,6 +251,10 @@ foreach ($uses_of_new as $new_operator) {
|
||||||
$name->getTypeName() == 'n_VARIABLE_VARIABLE') {
|
$name->getTypeName() == 'n_VARIABLE_VARIABLE') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$name_concrete = strtolower($name->getConcreteString());
|
||||||
|
if (isset($magic_names[$name_concrete])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$need[] = array(
|
$need[] = array(
|
||||||
'type' => 'class',
|
'type' => 'class',
|
||||||
'symbol' => $name,
|
'symbol' => $name,
|
||||||
|
@ -258,12 +268,7 @@ foreach ($static_uses as $static_use) {
|
||||||
if ($name->getTypeName() != 'n_CLASS_NAME') {
|
if ($name->getTypeName() != 'n_CLASS_NAME') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$name_concrete = $name->getConcreteString();
|
$name_concrete = strtolower($name->getConcreteString());
|
||||||
$magic_names = array(
|
|
||||||
'static' => true,
|
|
||||||
'parent' => true,
|
|
||||||
'self' => true,
|
|
||||||
);
|
|
||||||
if (isset($magic_names[$name_concrete])) {
|
if (isset($magic_names[$name_concrete])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue