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

Improve the "invalid parent scope" linter rule

Summary: This linter rule was introduced in D12420, but fails to handle a specific edge case.

Test Plan: Added test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12853
This commit is contained in:
Joshua Spence 2015-05-18 07:47:19 +10:00
parent f9cefb7e2d
commit 1df248cc2d
2 changed files with 9 additions and 1 deletions

View file

@ -3872,7 +3872,11 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
->selectDescendantsOfType('n_CLASS_STATIC_ACCESS');
foreach ($static_accesses as $static_access) {
$called_class = $static_access->getChildOfType(0, 'n_CLASS_NAME');
$called_class = $static_access->getChildByIndex(0);
if ($called_class->getTypeName() != 'n_CLASS_NAME') {
continue;
}
if ($called_class->getConcreteString() == 'parent') {
$this->raiseLintAtNode(

View file

@ -10,6 +10,10 @@ final class MyInvalidClass {
public function __construct() {
parent::__construct(null);
}
public function someMethod($x) {
echo $x::SOME_CONSTANT;
}
}
~~~~~~~~~~
error:11:5