Skip to content

Commit

Permalink
[DX] Display rule count in list-rules (#4848)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Aug 24, 2023
1 parent f8ed35c commit 9a07a7b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ public function resolve(Node $node): Type
}

foreach ($callerType->getObjectClassReflections() as $objectClassReflection) {
$classMethodReturnType = $this->resolveClassMethodReturnType($objectClassReflection, $node, $methodName, $scope);
$classMethodReturnType = $this->resolveClassMethodReturnType(
$objectClassReflection,
$node,
$methodName,
$scope
);
if (! $classMethodReturnType instanceof MixedType) {
return $classMethodReturnType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ private function resolveParamDefault(Expr $expr): Expr
{
// re-create to avoid TokenStream error
if ($expr instanceof String_) {
return new String_($expr->value, [AttributeKey::KIND => $expr->getAttribute(AttributeKey::KIND)]);
return new String_($expr->value, [
AttributeKey::KIND => $expr->getAttribute(AttributeKey::KIND),
]);
}

if ($expr instanceof LNumber) {
Expand All @@ -258,7 +260,9 @@ private function resolveParamDefault(Expr $expr): Expr
}

if ($expr instanceof Array_ && $expr->items === []) {
return new Array_($expr->items, [AttributeKey::KIND => $expr->getAttribute(AttributeKey::KIND)]);
return new Array_($expr->items, [
AttributeKey::KIND => $expr->getAttribute(AttributeKey::KIND),
]);
}

$printParamDefault = $this->betterStandardPrinter->print($expr);
Expand Down
5 changes: 4 additions & 1 deletion src/Console/Command/ListRulesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->symfonyStyle->listing($skippedClasses);
}

$this->symfonyStyle->newLine();
$this->symfonyStyle->note(sprintf('Loaded %d rules', count($rectorClasses)));

return Command::SUCCESS;
}

Expand All @@ -84,7 +87,7 @@ private function resolveRectorClasses(): array
$rectorClasses = array_map(static fn (RectorInterface $rector): string => $rector::class, $customRectors);
sort($rectorClasses);

return $rectorClasses;
return array_unique($rectorClasses);
}

/**
Expand Down

0 comments on commit 9a07a7b

Please sign in to comment.