sdk-php icon indicating copy to clipboard operation
sdk-php copied to clipboard

[Bug] WorkerFactoryInterface seems to be missing arguments for newWorker() method

Open vansante opened this issue 10 months ago • 3 comments

What are you really trying to do?

Setting a ExceptionInterceptorInterface and PipelineProvider with the newWorker method.

Describe the bug

The interface method is:

    public function newWorker(
        string $taskQueue = self::DEFAULT_TASK_QUEUE,
        ?WorkerOptions $options = null,
    ): WorkerInterface;

But the actual implementation is:

    public function newWorker(
        string $taskQueue = self::DEFAULT_TASK_QUEUE,
        ?WorkerOptions $options = null,
        ?ExceptionInterceptorInterface $exceptionInterceptor = null,
        ?PipelineProvider $interceptorProvider = null,
    ): WorkerInterface {
        // .. implementation
    }

Minimal Reproduction

Not really relevant, just install the sdk.

Environment/Versions

Also irrelevant.

Additional context

The interface should describe the full method with all arguments.

vansante avatar Feb 20 '25 09:02 vansante

The interface is in the public space, so changing it can be considered a breaking change (even though it's not intended to be implemented by the user). Overall, there is no strong reason to update it for now.

roxblnfk avatar Feb 20 '25 14:02 roxblnfk

Is it really a breaking change when they are defaulted to null anyway? That means they can be omitted right?

vansante avatar Feb 20 '25 14:02 vansante

If we add parameters to the interface method, we will break all implementations that we do not control.

roxblnfk avatar Feb 20 '25 14:02 roxblnfk