Skip to content

Commit

Permalink
Simplify 'if'
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jan 20, 2023
1 parent 291e5d4 commit d77d23a
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ protected function getPublicationTypesToValidate(): Collection

protected function getPublicationTypeFromArgument(Collection $publicationTypes, string $name): Collection
{
if (!$publicationTypes->has($name)) {
throw new InvalidArgumentException("Publication type [$name] does not exist");
}
return collect([$name => PublicationType::get($name)]);
return $publicationTypes->has($name)
? collect([$name => PublicationType::get($name)])
: throw new InvalidArgumentException("Publication type [$name] does not exist");
}

protected function displayResults(): void
Expand Down

0 comments on commit d77d23a

Please sign in to comment.