Skip to content

Commit

Permalink
Fixed PHPStan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sebprt committed Oct 26, 2023
1 parent 3bad503 commit 45dc906
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
6 changes: 1 addition & 5 deletions src/Cloud/DTO/JobList.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

readonly class JobList implements \Countable, \IteratorAggregate
{
/** @var DTO\Workflow\JobInterface<DTO\Workflow\Pipeline|DTO\Workflow\Action>[] */
private array $jobs;

Check failure on line 12 in src/Cloud/DTO/JobList.php

View workflow job for this annotation

GitHub Actions / phpstan

PHPDoc tag @var for property Kiboko\Component\Satellite\Cloud\DTO\JobList::$jobs contains generic type Kiboko\Component\Satellite\Cloud\DTO\Workflow\JobInterface<Kiboko\Component\Satellite\Cloud\DTO\Workflow\Action|Kiboko\Component\Satellite\Cloud\DTO\Workflow\Pipeline> but interface Kiboko\Component\Satellite\Cloud\DTO\Workflow\JobInterface is not generic.

public function __construct(
Expand All @@ -27,11 +28,6 @@ public function getIterator(): \Traversable
public function codes(): array
{
$jobs = $this->jobs;

/**
* @var DTO\Workflow\Pipeline|DTO\Workflow\Action $left
* @var DTO\Workflow\Pipeline|DTO\Workflow\Action $right
*/
usort($jobs, fn (DTO\Workflow\JobInterface $left, DTO\Workflow\JobInterface $right) => $left->order <=> $right->order);

Check failure on line 31 in src/Cloud/DTO/JobList.php

View workflow job for this annotation

GitHub Actions / phpstan

Access to an undefined property Kiboko\Component\Satellite\Cloud\DTO\Workflow\JobInterface<Kiboko\Component\Satellite\Cloud\DTO\Workflow\Action|Kiboko\Component\Satellite\Cloud\DTO\Workflow\Pipeline>::$order.

Check failure on line 31 in src/Cloud/DTO/JobList.php

View workflow job for this annotation

GitHub Actions / phpstan

Access to an undefined property Kiboko\Component\Satellite\Cloud\DTO\Workflow\JobInterface<Kiboko\Component\Satellite\Cloud\DTO\Workflow\Action|Kiboko\Component\Satellite\Cloud\DTO\Workflow\Pipeline>::$order.

return array_map(fn (DTO\Workflow\JobInterface $job) => $job->code->asString(), $jobs);

Check failure on line 33 in src/Cloud/DTO/JobList.php

View workflow job for this annotation

GitHub Actions / phpstan

Access to an undefined property Kiboko\Component\Satellite\Cloud\DTO\Workflow\JobInterface<Kiboko\Component\Satellite\Cloud\DTO\Workflow\Action|Kiboko\Component\Satellite\Cloud\DTO\Workflow\Pipeline>::$code.
Expand Down
7 changes: 2 additions & 5 deletions src/Cloud/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,8 @@ private static function fromApiModel(Api\Client $client, Api\Model\WorkflowRead
$step->getLabel(),
new StepCode($step->getCode()),
$step->getConfiguration(),
new ProbeList(...array_map(
fn (Api\Model\Probe $probe, int $order) => new Probe($probe->getLabel(), $probe->getCode(), $order),
$probes = $step->getProbes(),
range(0, is_countable($probes) ? \count($probes) : 0),
)),
/** TODO : implement probes when it is enabled */
new ProbeList(),
$order
),
$steps = $job->getPipeline()->getSteps(),
Expand Down

0 comments on commit 45dc906

Please sign in to comment.