Skip to content

Commit

Permalink
Merge pull request #10 from php-etl/feature/with-step-codes
Browse files Browse the repository at this point in the history
Updated pipeline-contracts package to add the step codes
  • Loading branch information
gplanchat authored Nov 13, 2023
2 parents 90a6ba7 + bc4b79f commit 56c1801
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 54 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/phpstan-5.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/quality.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Quality (PHPStan level 4)
name: Quality (PHPStan level 5)
on: push
jobs:
cs-fixer:
Expand Down Expand Up @@ -34,5 +34,5 @@ jobs:
uses: php-actions/phpstan@v3
with:
path: src/
level: 4
level: 5
php_version: '8.2'
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "0.4.x-dev"
"dev-main": "0.5.x-dev"
}
}
}
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;
}
10 changes: 8 additions & 2 deletions src/NullRejection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ public function initialize(): void
// NOOP
}

/** @param non-empty-array<mixed>|object $rejection */
public function reject(array|object $rejection, \Throwable $exception = null, string $reason = null): void
/** @param non-empty-array<array-key, mixed>|object $rejection */
public function reject(StepCodeInterface $step, array|object $rejection, \Throwable $exception = null, string $reason = null): void
{
// NOOP
}

/** @param non-empty-array<array-key, mixed>|object $rejection */
public function rejectWithReason(StepCodeInterface $step, array|object $rejection, string $reason, \Throwable $exception = 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
2 changes: 1 addition & 1 deletion src/PipelineRunnerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
interface PipelineRunnerInterface
{
/**
* @param \Iterator<array|object> $source
* @param \Iterator<int, array|object> $source
* @param \Generator<mixed, Type, ResultBucketInterface<Type>, void> $async
*
* @return \Iterator<array|object>
Expand Down
7 changes: 5 additions & 2 deletions src/RejectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ 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;
/** @param non-empty-array<array-key, mixed>|object $rejection */
public function reject(StepCodeInterface $step, array|object $rejection, \Throwable $exception = null): void;

/** @param non-empty-array<array-key, mixed>|object $rejection */
public function rejectWithReason(StepCodeInterface $step, array|object $rejection, string $reason, \Throwable $exception = null): void;

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;
}
7 changes: 7 additions & 0 deletions src/StepCodeInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

declare(strict_types=1);

namespace Kiboko\Contract\Pipeline;

interface StepCodeInterface extends \Stringable {}
17 changes: 17 additions & 0 deletions src/StepRejectionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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(array|object $rejection, string $reason, \Throwable $exception = null): void;

Check failure on line 14 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 14 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 14 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 56c1801

Please sign in to comment.