Skip to content

Commit

Permalink
fix(command): Make "roles" optional
Browse files Browse the repository at this point in the history
  • Loading branch information
pan93412 committed Jan 6, 2025
1 parent dc81c1a commit abe6b81
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 @@ -143,15 +143,15 @@ private static function parseUsers(string $filename): array
$rolesIndex = array_search('roles', $header, true);
$groupIndex = array_search('group', $header, true);

if (!\is_int($emailIndex) || !\is_int($nameIndex) || !\is_int($rolesIndex)) {
throw new \RuntimeException("Could not find email, name, or roles in the header of {$filename}.");
if (!\is_int($emailIndex) || !\is_int($nameIndex)) {
throw new \RuntimeException("Could not find email or name in the header of {$filename}.");
}

$users = [];
while (($row = fgetcsv($file)) !== false) {
$email = $row[$emailIndex];
$name = $row[$nameIndex];
$roles = $row[$rolesIndex];
$roles = false !== $rolesIndex ? $row[$rolesIndex] : null;
$group = false !== $groupIndex ? $row[$groupIndex] : null;

if (null === $email || null === $name) {
Expand Down

0 comments on commit abe6b81

Please sign in to comment.