Skip to content

Commit

Permalink
Fix exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Oct 17, 2023
1 parent 5a88fb6 commit 71d4656
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and'
}

if (func_num_args() === 1 && is_scalar($column)) {
throw new ArgumentCountError(sprintf('Too few arguments to function %s(%s), 1 passed and at least 2 expected when the 1st is a scalar.', __METHOD__, var_export($column, true)));
throw new ArgumentCountError(sprintf('Too few arguments to function %s(%s), 1 passed and at least 2 expected when the 1st is not an array.', __METHOD__, var_export($column, true)));
}

return parent::where(...$params);
Expand Down
4 changes: 2 additions & 2 deletions tests/Query/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1180,13 +1180,13 @@ public static function provideExceptions(): iterable

yield 'find with single string argument' => [
ArgumentCountError::class,
'Too few arguments to function MongoDB\Laravel\Query\Builder::where(\'foo\'), 1 passed and at least 2 expected when the 1st is a scalar',
'Too few arguments to function MongoDB\Laravel\Query\Builder::where(\'foo\'), 1 passed and at least 2 expected when the 1st is not an array',
fn (Builder $builder) => $builder->where('foo'),
];

yield 'find with single numeric argument' => [
ArgumentCountError::class,
'Too few arguments to function MongoDB\Laravel\Query\Builder::where(123), 1 passed and at least 2 expected when the 1st is a scalar',
'Too few arguments to function MongoDB\Laravel\Query\Builder::where(123), 1 passed and at least 2 expected when the 1st is not an array',
fn (Builder $builder) => $builder->where(123),
];

Expand Down

0 comments on commit 71d4656

Please sign in to comment.