Skip to content

Commit

Permalink
Updated pipeline-contracts package to add the step codes everywhere i…
Browse files Browse the repository at this point in the history
…t is necessary
  • Loading branch information
gplanchat committed Nov 13, 2023
1 parent 90a6ba7 commit 2e621c4
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 24 deletions.
5 changes: 3 additions & 2 deletions src/ExtractingInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ interface ExtractingInterface
* @param ExtractorInterface<Type> $extractor
*/
public function extract(
StepCodeInterface $step,
ExtractorInterface $extractor,
RejectionInterface $rejection,
StateInterface $state,
StepRejectionInterface $rejection,
StepStateInterface $state,
): self;
}
5 changes: 3 additions & 2 deletions src/LoadingInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ interface LoadingInterface
* @param LoaderInterface<Type> $loader
*/
public function load(
StepCodeInterface $step,
LoaderInterface $loader,
RejectionInterface $rejection,
StateInterface $state,
StepRejectionInterface $rejection,
StepStateInterface $state,
): self;
}
2 changes: 1 addition & 1 deletion src/NullRejection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function initialize(): void
}

/** @param non-empty-array<mixed>|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
}
Expand Down
6 changes: 3 additions & 3 deletions src/NullState.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion src/RejectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ interface RejectionInterface
public function initialize(): void;

/** @param non-empty-array<mixed>|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;

Check failure on line 13 in src/RejectionInterface.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Kiboko\Contract\Pipeline\RejectionInterface::rejectWithReason() has parameter $rejection with no value type specified in iterable type array.

Check failure on line 13 in src/RejectionInterface.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Kiboko\Contract\Pipeline\RejectionInterface::rejectWithReason() has parameter $rejection with no value type specified in iterable type array.

Check failure on line 13 in src/RejectionInterface.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Kiboko\Contract\Pipeline\RejectionInterface::rejectWithReason() has parameter $rejection with no value type specified in iterable type array.

public function teardown(): void;
}
10 changes: 0 additions & 10 deletions src/RejectionWithReasonInterface.php

This file was deleted.

6 changes: 3 additions & 3 deletions src/StateInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ interface StateInterface
{
public function initialize(int $start = 0): void;

public function accept(int $step = 1): void;
public function accept(StepCodeInterface $step, int $count = 1): void;

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

public function error(int $step = 1): void;
public function error(StepCodeInterface $step, int $count = 1): void;

public function teardown(): void;
}
9 changes: 9 additions & 0 deletions src/StepCodeInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace Kiboko\Contract\Pipeline;

interface StepCodeInterface extends \Stringable
{
}
16 changes: 16 additions & 0 deletions src/StepRejectionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Kiboko\Contract\Pipeline;

interface StepRejectionInterface
{
public function initialize(): void;

/** @param non-empty-array<mixed>|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;

Check failure on line 13 in src/StepRejectionInterface.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Kiboko\Contract\Pipeline\StepRejectionInterface::rejectWithReason() has parameter $rejection with no value type specified in iterable type array.

Check failure on line 13 in src/StepRejectionInterface.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Kiboko\Contract\Pipeline\StepRejectionInterface::rejectWithReason() has parameter $rejection with no value type specified in iterable type array.

Check failure on line 13 in src/StepRejectionInterface.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Kiboko\Contract\Pipeline\StepRejectionInterface::rejectWithReason() has parameter $rejection with no value type specified in iterable type array.

public function teardown(): void;
}
14 changes: 14 additions & 0 deletions src/StepStateInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace Kiboko\Contract\Pipeline;

interface StepStateInterface
{
public function accept(StepCodeInterface $step, int $count = 1): void;

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

public function error(StepCodeInterface $step, int $count = 1): void;
}
5 changes: 3 additions & 2 deletions src/TransformingInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ interface TransformingInterface
* @param TransformerInterface<Type> $transformer
*/
public function transform(
StepCodeInterface $step,
TransformerInterface $transformer,
RejectionInterface $rejection,
StateInterface $state,
StepRejectionInterface $rejection,
StepStateInterface $state,
): self;
}

0 comments on commit 2e621c4

Please sign in to comment.