Remove array typehints from batch callbacks

Created on 30 May 2023, almost 2 years ago

Problem/Motivation

When we are trying to use DeepL in a cron task triggered by Drush, we are facing an issue that Core faced 7 years ago ( #2664290: Remove array typehints from batch callbacks ).

Steps to reproduce

In a hook_cron

  • Create a job programatically that uses DeepL
  • Add items to the job
  • Save the job then requestTranslation
  • Execute the batch using drush_backend_batch_process()

Result: TypeError: Drupal\tmgmt_deepl\Plugin\tmgmt\Translator\DeeplTranslator::batchRequestTranslation(): Argument #5 ($context) must be of type array, DrushBatchContext given

Proposed resolution

Follow Core lead and remove type hints on the batch callbacks.

📌 Task
Status

Fixed

Version

2.1

Component

Code

Created by

🇫🇷France duaelfr Montpellier, France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024