mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 06:42:41 +01:00
Use PhutilClassMapQuery
Summary: Use `PhutilClassMapQuery` where appropriate. Test Plan: `arc unit` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D13428
This commit is contained in:
parent
bbccf1dd40
commit
4d6d3feb7f
1 changed files with 3 additions and 22 deletions
|
@ -6,29 +6,10 @@ abstract class ArcanistXHPASTLinterRule extends Phobject {
|
||||||
private $lintID = null;
|
private $lintID = null;
|
||||||
|
|
||||||
final public static function loadAllRules() {
|
final public static function loadAllRules() {
|
||||||
$rules = array();
|
return id(new PhutilClassMapQuery())
|
||||||
|
|
||||||
$symbols = id(new PhutilSymbolLoader())
|
|
||||||
->setAncestorClass(__CLASS__)
|
->setAncestorClass(__CLASS__)
|
||||||
->loadObjects();
|
->setUniqueMethod('getLintID')
|
||||||
|
->execute();
|
||||||
foreach ($symbols as $class => $rule) {
|
|
||||||
$id = $rule->getLintID();
|
|
||||||
|
|
||||||
if (isset($rules[$id])) {
|
|
||||||
throw new Exception(
|
|
||||||
pht(
|
|
||||||
'Two linter rules (`%s`, `%s`) share the same lint ID (%d). '.
|
|
||||||
'Each linter rule must have a unique ID.',
|
|
||||||
$class,
|
|
||||||
get_class($rules[$id]),
|
|
||||||
$id));
|
|
||||||
}
|
|
||||||
|
|
||||||
$rules[$id] = $rule;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $rules;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function getLintID() {
|
final public function getLintID() {
|
||||||
|
|
Loading…
Reference in a new issue