Skip to content

Commit

Permalink
fix(command): Group and Roles can be null
Browse files Browse the repository at this point in the history
  • Loading branch information
pan93412 committed Jan 6, 2025
1 parent 4438be3 commit dc81c1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Command/CreateUsersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ private static function parseUsers(string $filename): array
$roles = $row[$rolesIndex];
$group = false !== $groupIndex ? $row[$groupIndex] : null;

if (!\is_string($email) || !\is_string($name) || !\is_string($roles) || !\is_string($group)) {
throw new \RuntimeException("Invalid row in {$filename}.");
if (null === $email || null === $name) {
throw new \RuntimeException("Email or Name is required in {$filename}.");
}

$users[] = [
'email' => $email,
'name' => $name,
'roles' => explode(',', $roles),
'roles' => null !== $roles ? explode(',', $roles) : [],
'group' => $group,
];
}
Expand Down

0 comments on commit dc81c1a

Please sign in to comment.