Skip to content

Commit

Permalink
SSH key label cannot be null (#1439)
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell authored Mar 21, 2023
1 parent b398a6a commit 9028423
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Command/Ssh/SshKeyCommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ public static function getIdeSshKeyLabel(IdeResponse $ide): string {
}

/**
* @param string $label
* @param string|null $label
* The label to normalize.
* @return string|string[]|null
* @return string|null
*/
public static function normalizeSshKeyLabel(string $label): array|string|null {
public static function normalizeSshKeyLabel(?string $label): string|null {
if (is_null($label)) {
throw new RuntimeException('The label cannot be empty');
}
// It may only contain letters, numbers and underscores.
return preg_replace('/[^A-Za-z0-9_]/', '', $label);
}
Expand Down

0 comments on commit 9028423

Please sign in to comment.