Skip to content

Commit

Permalink
Alternative count
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Mar 14, 2019
1 parent 760400c commit d98f31c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Symfony/Component/HttpClient/HttpClientTrait.php
Expand Up @@ -72,9 +72,8 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
}

if (\is_array($options['auth'] ?? null)) {
$count = \count($options['auth']);
if ($count <= 0 || $count > 2) {
throw new InvalidArgumentException(sprintf('Option "auth" must contain 1 or 2 elements, %s given.', $count));
if (!\in_array(\count($options['auth']), [1, 2], true)) {
throw new InvalidArgumentException(sprintf('Option "auth" must contain 1 or 2 elements, %s given.', \count($options['auth'])));
}

$options['auth'] = implode(':', $options['auth']);
Expand Down

0 comments on commit d98f31c

Please sign in to comment.