Add deprecation warning for new required parameter in Text target

Created on 11 September 2024, 11 months ago
Updated 12 September 2024, 11 months ago

Problem/Motivation

In Feeds 8.x-3.0-rc1 a new parameter was added to \Drupal\feeds\Feeds\Target\Text::__construct(). This however caused the tests from the module Paragraphs to fail, which has a class that extends
\Drupal\feeds\Feeds\Target\Text and overrides its constructor.

An issue for Paragraphs has been created to fix that: 📌 Feeds integration: update constructor of FeedsTarget plugin to fix tests Needs review

However, meanwhile in the latest stable release of Paragraphs integration with Feeds will be broken. Therefore I think we should make the new added parameter in the Text class optional and trigger a deprecation warning for it.

And then schedule a 8.x-3.0-rc2 release.

Steps to reproduce

  • Install Feeds 8.x-3.0-rc1
  • Install Paragraphs 8.x-1.18
  • Add a paragraphs field to a content type.
  • Add a feed type and try to add mapping for the paragraphs field.

The following error may then appear or get logged:

ArgumentCountError: Too few arguments to function Drupal\feeds\Feeds\Target\Text::__construct(), 4 passed in /paragraphs/src/Feeds/Target/Paragraphs.php on line 48 and exactly 5 expected in Drupal\feeds\Feeds\Target\Text->__construct() (line 56 of /feeds/src/Feeds/Target/Text.php).

Proposed resolution

Make the parameter $filter_format_storage optional and issue a deprecation warning instead.

Remaining tasks

  • Draft a change record.
  • Make the parameter $filter_format_storage in \Drupal\feeds\Feeds\Target\Text::__construct() optional.
  • Trigger an error with a deprecation warning for the newly added optional constructor parameter that is not set.
  • Update phpstan.neon to ignore the dependency injection issue.
  • Commit.
  • Publish the change record.

User interface changes

None.

API changes

\Drupal\feeds\Feeds\Target\Text::__construct() will get an optional additional parameter. An error with a deprecation warning is triggered when not set.

Data model changes

None.

📌 Task
Status

Fixed

Version

3.0

Component

Code

Created by

🇳🇱Netherlands megachriz

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024