Skip to content

Commit

Permalink
Updated the bucket contract
Browse files Browse the repository at this point in the history
  • Loading branch information
gplanchat committed Nov 14, 2023
1 parent 892fe04 commit 60ebf74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/IteratorRejectionResultBucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/** @param \Iterator<int, Type> $iterator */
public function __construct(
private string $reason,
private \Throwable $exception,
private ?\Throwable $exception,
private \Iterator $iterator,
) {}

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

public function exceptions(): ?array
{
if ($this->exception === null) {
return null;
}
return [$this->exception];
}

Expand Down
6 changes: 5 additions & 1 deletion src/RejectionResultBucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class RejectionResultBucket implements Contract\RejectionResultBucketInter
/** @param Type ...$values */
public function __construct(
private readonly string $reason,
private readonly \Throwable $exception,
private readonly ?\Throwable $exception,
...$values,
) {
$this->values = array_values($values);
Expand All @@ -32,6 +32,10 @@ public function reasons(): ?array

public function exceptions(): ?array
{
if ($this->exception === null) {
return null;
}

return [$this->exception];
}

Expand Down

0 comments on commit 60ebf74

Please sign in to comment.