From 2e621c4971368f8c0f2a93aa9a069e455693ed7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Mon, 13 Nov 2023 12:23:10 +0100 Subject: [PATCH] Updated pipeline-contracts package to add the step codes everywhere it is necessary --- src/ExtractingInterface.php | 5 +++-- src/LoadingInterface.php | 5 +++-- src/NullRejection.php | 2 +- src/NullState.php | 6 +++--- src/RejectionInterface.php | 3 ++- src/RejectionWithReasonInterface.php | 10 ---------- src/StateInterface.php | 6 +++--- src/StepCodeInterface.php | 9 +++++++++ src/StepRejectionInterface.php | 16 ++++++++++++++++ src/StepStateInterface.php | 14 ++++++++++++++ src/TransformingInterface.php | 5 +++-- 11 files changed, 57 insertions(+), 24 deletions(-) delete mode 100644 src/RejectionWithReasonInterface.php create mode 100644 src/StepCodeInterface.php create mode 100644 src/StepRejectionInterface.php create mode 100644 src/StepStateInterface.php diff --git a/src/ExtractingInterface.php b/src/ExtractingInterface.php index 8f46007..383e8d2 100644 --- a/src/ExtractingInterface.php +++ b/src/ExtractingInterface.php @@ -12,8 +12,9 @@ interface ExtractingInterface * @param ExtractorInterface $extractor */ public function extract( + StepCodeInterface $step, ExtractorInterface $extractor, - RejectionInterface $rejection, - StateInterface $state, + StepRejectionInterface $rejection, + StepStateInterface $state, ): self; } diff --git a/src/LoadingInterface.php b/src/LoadingInterface.php index 3dc720f..073c97b 100644 --- a/src/LoadingInterface.php +++ b/src/LoadingInterface.php @@ -12,8 +12,9 @@ interface LoadingInterface * @param LoaderInterface $loader */ public function load( + StepCodeInterface $step, LoaderInterface $loader, - RejectionInterface $rejection, - StateInterface $state, + StepRejectionInterface $rejection, + StepStateInterface $state, ): self; } diff --git a/src/NullRejection.php b/src/NullRejection.php index bd5b239..b2d5ab7 100644 --- a/src/NullRejection.php +++ b/src/NullRejection.php @@ -12,7 +12,7 @@ public function initialize(): void } /** @param non-empty-array|object $rejection */ - public function reject(array|object $rejection, \Throwable $exception = null, string $reason = null): void + public function reject(StepCodeInterface $step, array|object $rejection, \Throwable $exception = null, string $reason = null): void { // NOOP } diff --git a/src/NullState.php b/src/NullState.php index 437b6f9..c9b0970 100644 --- a/src/NullState.php +++ b/src/NullState.php @@ -11,17 +11,17 @@ public function initialize(int $start = 0): void // NOOP } - public function accept(int $step = 1): void + public function accept(StepCodeInterface $step, int $count = 1): void { // NOOP } - public function reject(int $step = 1): void + public function reject(StepCodeInterface $step, int $count = 1): void { // NOOP } - public function error(int $step = 1): void + public function error(StepCodeInterface $step, int $count = 1): void { // NOOP } diff --git a/src/RejectionInterface.php b/src/RejectionInterface.php index a11fdab..3dd1dda 100644 --- a/src/RejectionInterface.php +++ b/src/RejectionInterface.php @@ -9,7 +9,8 @@ interface RejectionInterface public function initialize(): void; /** @param non-empty-array|object $rejection */ - public function reject(array|object $rejection, \Throwable $exception = null, string $reason = null): void; + public function reject(StepCodeInterface $step, array|object $rejection, \Throwable $exception = null): void; + public function rejectWithReason(StepCodeInterface $step, object|array $rejection, string $reason, null|\Throwable $exception = null): void; public function teardown(): void; } diff --git a/src/RejectionWithReasonInterface.php b/src/RejectionWithReasonInterface.php deleted file mode 100644 index a8aedf7..0000000 --- a/src/RejectionWithReasonInterface.php +++ /dev/null @@ -1,10 +0,0 @@ -|object $rejection */ + public function reject(array|object $rejection, \Throwable $exception = null): void; + public function rejectWithReason(object|array $rejection, string $reason, null|\Throwable $exception = null): void; + + public function teardown(): void; +} diff --git a/src/StepStateInterface.php b/src/StepStateInterface.php new file mode 100644 index 0000000..00f42b1 --- /dev/null +++ b/src/StepStateInterface.php @@ -0,0 +1,14 @@ + $transformer */ public function transform( + StepCodeInterface $step, TransformerInterface $transformer, - RejectionInterface $rejection, - StateInterface $state, + StepRejectionInterface $rejection, + StepStateInterface $state, ): self; }