Skip to content

Commit 1032072

Browse files
committed
Add DevTools self-update command
1 parent 1240169 commit 1032072

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

src/Console/Command/SelfUpdateCommand.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,12 @@ public static function getCommandNames(): array
6666
}
6767

6868
$reflection = new ReflectionClass(self::class);
69-
$attribute = $reflection->getAttributes(AsCommand::class)[0] ?? null;
70-
71-
if (null === $attribute) {
72-
return $commandNames = [];
73-
}
74-
75-
$arguments = $attribute->getArguments();
76-
$commandName = $arguments['name'] ?? $arguments[0] ?? '';
77-
$aliases = $arguments['aliases'] ?? $arguments[2] ?? [];
78-
$commandNames = [$commandName, ...((array) $aliases)];
69+
$arguments = $reflection->getAttributes(AsCommand::class)[0]->getArguments();
70+
$commandNames = [$arguments['name'], ...$arguments['aliases']];
7971

8072
return $commandNames = array_values(array_filter(
8173
$commandNames,
82-
static fn(mixed $commandName): bool => \is_string($commandName) && '' !== $commandName,
74+
static fn(string $commandName): bool => '' !== $commandName,
8375
));
8476
}
8577

0 commit comments

Comments
 (0)