diff --git a/src/ComplexResultBucket.php b/src/ComplexResultBucket.php index 7c421de..cfa7386 100644 --- a/src/ComplexResultBucket.php +++ b/src/ComplexResultBucket.php @@ -49,9 +49,7 @@ public function reasons(): ?array { return array_reduce( array_map( - function (Contract\RejectionResultBucketInterface $rejection): ?array { - return $rejection->reasons(); - }, + fn(Contract\RejectionResultBucketInterface $rejection): ?array => $rejection->reasons(), $this->rejections ), function (array $carry, ?array $item): array { @@ -68,9 +66,7 @@ public function exceptions(): ?array { return array_reduce( array_map( - function (Contract\RejectionResultBucketInterface $rejection): ?array { - return $rejection->exceptions(); - }, + fn(Contract\RejectionResultBucketInterface $rejection): ?array => $rejection->exceptions(), $this->rejections ), function (array $carry, ?array $item): array { diff --git a/src/RejectionResultBucket.php b/src/RejectionResultBucket.php index 177d2c1..6187e40 100644 --- a/src/RejectionResultBucket.php +++ b/src/RejectionResultBucket.php @@ -18,8 +18,8 @@ final class RejectionResultBucket implements Contract\RejectionResultBucketInter /** @param Type ...$values */ public function __construct( - private string $reason, - private \Throwable $exception, + private readonly string $reason, + private readonly \Throwable $exception, ...$values, ) { $this->values = array_values($values);