Skip to content

Commit 60ebf74

Browse files
committed
Updated the bucket contract
1 parent 892fe04 commit 60ebf74

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/IteratorRejectionResultBucket.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/** @param \Iterator<int, Type> $iterator */
1717
public function __construct(
1818
private string $reason,
19-
private \Throwable $exception,
19+
private ?\Throwable $exception,
2020
private \Iterator $iterator,
2121
) {}
2222

@@ -27,6 +27,9 @@ public function reasons(): ?array
2727

2828
public function exceptions(): ?array
2929
{
30+
if ($this->exception === null) {
31+
return null;
32+
}
3033
return [$this->exception];
3134
}
3235

src/RejectionResultBucket.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class RejectionResultBucket implements Contract\RejectionResultBucketInter
1919
/** @param Type ...$values */
2020
public function __construct(
2121
private readonly string $reason,
22-
private readonly \Throwable $exception,
22+
private readonly ?\Throwable $exception,
2323
...$values,
2424
) {
2525
$this->values = array_values($values);
@@ -32,6 +32,10 @@ public function reasons(): ?array
3232

3333
public function exceptions(): ?array
3434
{
35+
if ($this->exception === null) {
36+
return null;
37+
}
38+
3539
return [$this->exception];
3640
}
3741

0 commit comments

Comments
 (0)