Migrate GenerateKeyCommand to symfony/console attributes

This commit is contained in:
Alejandro Celaya
2025-12-13 16:49:52 +01:00
parent c53f538c79
commit 5df3abbce9
6 changed files with 92 additions and 127 deletions

View File

@@ -14,6 +14,7 @@ use Shlinkio\Shlink\Rest\Entity\ApiKeyRole;
use function sprintf;
/** @deprecated API key roles are deprecated */
enum Role: string
{
case AUTHORED_SHORT_URLS = 'AUTHORED_SHORT_URLS';
@@ -29,15 +30,6 @@ enum Role: string
};
}
public function paramName(): string
{
return match ($this) {
self::AUTHORED_SHORT_URLS => 'author-only',
self::DOMAIN_SPECIFIC => 'domain-only',
self::NO_ORPHAN_VISITS => 'no-orphan-visits',
};
}
public static function toSpec(ApiKeyRole $role, string|null $context = null): Specification
{
return match ($role->role) {