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 01d5128
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
7 changes: 3 additions & 4 deletions src/Cloud/DTO/JobList.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public function __construct(
public function getIterator(): \Traversable
{
$jobs = $this->jobs;

/** @phpstan-ignore-next-line **/
usort($jobs, fn (DTO\Workflow\JobInterface $left, DTO\Workflow\JobInterface $right) => $left->order <=> $right->order);

return new \ArrayIterator($jobs);
Expand All @@ -28,10 +30,7 @@ public function codes(): array
{
$jobs = $this->jobs;

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

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

Check failure on line 36 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::$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 01d5128

Please sign in to comment.