1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 14:52:40 +01:00

Improve linter rule for useless overriding methods

Summary: Ref T7409. This linter rule was added in D12419, but fails in some specific cases. Improve the handling of `n_DECLARATION_PARAMETER_LIST`.

Test Plan: Added unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7409

Differential Revision: https://secure.phabricator.com/D12828
This commit is contained in:
Joshua Spence 2015-05-15 07:10:28 +10:00
parent 4864435a50
commit e1a051a033
2 changed files with 12 additions and 3 deletions

View file

@ -3788,9 +3788,13 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$parameters = array(); $parameters = array();
foreach ($parameter_list->getChildren() as $parameter) { foreach ($parameter_list->getChildren() as $parameter) {
$parameters[] = $parameter $parameter = $parameter->getChildByIndex(1);
->getChildOfType(1, 'n_VARIABLE')
->getConcreteString(); if ($parameter->getTypeName() == 'n_VARIABLE_REFERENCE') {
$parameter = $parameter->getChildOfType(0, 'n_VARIABLE');
}
$parameters[] = $parameter->getConcreteString();
} }
$statements = $method->getChildByIndex(5); $statements = $method->getChildByIndex(5);

View file

@ -12,8 +12,13 @@ final class MyClass extends SomeOtherClass {
public function usefulMethod($x, array $y) { public function usefulMethod($x, array $y) {
return parent::usefulMethod($x, null); return parent::usefulMethod($x, null);
} }
public function anotherMethod($x, &$y) {
return parent::anotherMethod($x, $y);
}
} }
~~~~~~~~~~ ~~~~~~~~~~
error:3:13 error:3:13
advice:4:3 advice:4:3
advice:8:3 advice:8:3
advice:16:3