Skip to content

Commit

Permalink
Implemented reject with a given message
Browse files Browse the repository at this point in the history
  • Loading branch information
sebprt committed Jul 28, 2023
1 parent 5a37ebe commit d0eae59
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/NullRejection.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public function reject(object|array $rejection, null|\Throwable $exception = nul
// NOOP
}

public function rejectWithReason(Rejection $rejection): void
{
// NOOP
}

public function teardown(): void
{
// NOOP
Expand Down
12 changes: 12 additions & 0 deletions src/Rejection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Kiboko\Contract\Pipeline;

final class Rejection
{
public function __construct(
public string $reason = '',
public array $item,
) {
}
}
2 changes: 2 additions & 0 deletions src/RejectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ public function initialize(): void;
/** @param non-empty-array<mixed>|object $rejection */
public function reject(object|array $rejection, null|\Throwable $exception = null): void;

public function rejectWithReason(Rejection $rejection): void;

public function teardown(): void;
}

0 comments on commit d0eae59

Please sign in to comment.