Skip to content

Commit ad3984d

Browse files
committed
Fixed contracts on the pipeline rejection
1 parent 1fdcf91 commit ad3984d

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

src/NullStepRejection.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Kiboko\Contract\Pipeline;
6+
7+
final class NullStepRejection implements StepRejectionInterface
8+
{
9+
public function reject(array|object $rejection, \Throwable $exception = null): void
10+
{
11+
// NOOP
12+
}
13+
14+
public function rejectWithReason(array|object $rejection, string $reason, \Throwable $exception = null): void
15+
{
16+
// NOOP
17+
}
18+
}

src/NullStepState.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Kiboko\Contract\Pipeline;
6+
7+
final class NullStepState implements StepStateInterface
8+
{
9+
public function accept(int $count = 1): void
10+
{
11+
// NOOP
12+
}
13+
14+
public function reject(int $count = 1): void
15+
{
16+
// NOOP
17+
}
18+
19+
public function error(int $count = 1): void
20+
{
21+
// NOOP
22+
}
23+
}

src/StepStateInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
interface StepStateInterface
88
{
9-
public function accept(StepCodeInterface $step, int $count = 1): void;
9+
public function accept(int $count = 1): void;
1010

11-
public function reject(StepCodeInterface $step, int $count = 1): void;
11+
public function reject(int $count = 1): void;
1212

13-
public function error(StepCodeInterface $step, int $count = 1): void;
13+
public function error(int $count = 1): void;
1414
}

0 commit comments

Comments
 (0)