Skip to content

Commit f7e4c39

Browse files
committed
2 parents 5ec6169 + 55a7c1c commit f7e4c39

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Connection/ImapQueryBuilder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ public function header(string $header, string $value): static
232232
*/
233233
public function uid(int|string|array $uid): static
234234
{
235-
return $this->where(ImapSearchKey::Uid, implode(',', (array) $uid));
235+
return $this->where(ImapSearchKey::Uid, new RawQueryValue(
236+
Str::set(array_map('intval', (array) $uid))
237+
));
236238
}
237239

238240
/**

tests/Unit/Connection/ImapQueryBuilderTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,19 @@ function (ImapQueryBuilder $q) {
228228

229229
expect($builder->toImap())->toBe('FOO "Jou&AOk-"');
230230
});
231+
232+
test('compiles UID condition without quotes', function () {
233+
$builder = new ImapQueryBuilder;
234+
235+
$builder->uid(2);
236+
237+
expect($builder->toImap())->toBe('UID 2');
238+
});
239+
240+
test('compiles multiple UID values without quotes', function () {
241+
$builder = new ImapQueryBuilder;
242+
243+
$builder->uid([2, 3, 5]);
244+
245+
expect($builder->toImap())->toBe('UID 2,3,5');
246+
});

0 commit comments

Comments
 (0)