(PHPStan) Add a deprecation warning for constructing a RawFetcherResult without the file_system parameter

Created on 13 July 2024, about 2 months ago

Problem/Motivation

The parameter $file_system in \Drupal\feeds\Result\RawFetcherResult::__construct() is optional. To fix dependency injection in the future, we should make it required in the future. Deprecate that the parameter is optional.

It looks like there is no code in the Feeds code base that doesn't pass a value for the $file_system parameter already, so probably no calling code needs to be fixed.

Proposed resolution

Add a deprecation warning in \Drupal\feeds\Result\RawFetcherResult::__construct() for if the $file_system parameter is not set. Write a change record.

Code:

if (!isset($file_system)) {
  @trigger_error('Calling ' . __METHOD__ . '() without the $file_system argument is deprecated in feeds:3.0.0-rc1 and will be required in feeds:4.0.0. See https://www.drupal.org/node/xxx', E_USER_DEPRECATED);
  $entity_type_manager = \Drupal::service('entity_type.manager');
}

'xxx' should be the node ID of the change record.

Remaining tasks

  • Draft a change record.
  • Trigger an error with a deprecation message when the parameter $file_system in \Drupal\feeds\Result\RawFetcherResult::__construct() is not set.
  • Commit.
  • Publish the change record.

User interface changes

None.

API changes

\Drupal\feeds\Result\RawFetcherResult::__construct() will trigger an error with a deprecation message when the parameter $file_system is not set.

Data model changes

None.

📌 Task
Status

Active

Version

3.0

Component

Code

Created by

🇳🇱Netherlands MegaChriz

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

Comments & Activities

Production build 0.71.5 2024