Skip to content

ParameterAssertArrayTypeTrait doesn't provide feedback about supported union types #34

@rodber

Description

@rodber

Message should be ...is not compatible with type <list union types> and not just panic on the first mismatch.

1) Chevere\Tests\RunnerTest::testActionUnionMultipleAlternatives
Chevere\Workflow\Exceptions\JobsException: [job2]: Response **job1** conflict at parameter **foo**: Parameter `0` of type `Chevere\Parameter\StringParameter` is not compatible with type `Chevere\Parameter\IntParameter`
$run = run(
            workflow(
                job1: sync(
                    #[_return(new _union(new _int(), new _float()))]
                    function (): int|float {
                        return 123;
                    }
                ),
                job2: sync(
                    new class() extends Action {
                        public function __invoke(float|int|string $foo): array
                        {
                            return [
                                'foo' => $foo,
                            ];
                        }
                    },
                    foo: response('job1')
                ),
            ),
        );
        $this->assertSame(
            [
                'foo' => $run->response('job1')->int(),
            ],
            $run->response('job2')->array()
        );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions