-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kiboko\Component\Bucket; | ||
|
||
use Kiboko\Contract\Bucket as Contract; | ||
|
||
/** | ||
* @template Type | ||
* | ||
* @implements Contract\RejectionResultBucketInterface<Type> | ||
*/ | ||
final class RejectionWithReasonResultBucket implements Contract\RejectionResultBucketInterface | ||
{ | ||
public function __construct(private mixed $value, private ?string $reason = null) {} | ||
|
||
public function reject($value, $reason): self | ||
Check failure on line 18 in src/RejectionWithReasonResultBucket.php GitHub Actions / phpstan
Check failure on line 18 in src/RejectionWithReasonResultBucket.php GitHub Actions / phpstan
Check failure on line 18 in src/RejectionWithReasonResultBucket.php GitHub Actions / phpstan
Check failure on line 18 in src/RejectionWithReasonResultBucket.php GitHub Actions / phpstan
Check failure on line 18 in src/RejectionWithReasonResultBucket.php GitHub Actions / phpstan
Check failure on line 18 in src/RejectionWithReasonResultBucket.php GitHub Actions / phpstan
Check failure on line 18 in src/RejectionWithReasonResultBucket.php GitHub Actions / phpstan
Check failure on line 18 in src/RejectionWithReasonResultBucket.php GitHub Actions / phpstan
Check failure on line 18 in src/RejectionWithReasonResultBucket.php GitHub Actions / phpstan
|
||
{ | ||
$this->value = $value; | ||
$this->reason = $reason; | ||
|
||
return $this; | ||
} | ||
|
||
public function getReason(): ?string | ||
{ | ||
return $this->reason; | ||
} | ||
|
||
/** @return iterable<Type> */ | ||
public function walkRejection(): iterable | ||
{ | ||
return new \ArrayIterator([$this->value]); | ||
} | ||
} |