Deprecated function: Return type of Drupal\migrate_tools\IdMapFilter::accept()

Created on 8 September 2023, over 1 year ago

Problem/Motivation

When running migrations using the migrate_tools module, we are encountering the following deprecated function notices:

Deprecated function: Return type of Drupal\migrate_tools\IdMapFilter::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/docroot/modules/contrib/migrate_tools/src/IdMapFilter.php.

Deprecated function: Return type of Drupal\migrate_tools\SourceFilter::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/docroot/modules/contrib/migrate_tools/src/SourceFilter.php.

These deprecated notices are affecting the reliability and maintainability of our migration processes.

Steps to reproduce

  1. Install Drupal and enable the migrate_tools module.
  2. Create a migration configuration that utilizes migrate_tools.
  3. Run the migration process.
  4. Observe the deprecated function notices mentioned in the problem statement as they show up on the logs.

Proposed resolution

To address this issue, we propose the following steps:

Update the Drupal\migrate_tools\IdMapFilter::accept() function in /app/docroot/modules/contrib/migrate_tools/src/IdMapFilter.php to ensure its return type is compatible with FilterIterator::accept(): bool.

Update the Drupal\migrate_tools\SourceFilter::count() function in /app/docroot/modules/contrib/migrate_tools/src/SourceFilter.php to ensure its return type is compatible with Countable::count(): int.

Optionally, use the #[\ReturnTypeWillChange] attribute as a temporary measure to suppress the notices if making immediate changes to return types is not feasible.

These changes should resolve the deprecated function notices and improve the overall stability of the migrate_tools module.

Remaining tasks

  • Implement the proposed resolution steps outlined above.
  • Test the changes thoroughly to ensure they do not introduce regressions or other issues.
  • Update the module documentation to reflect the changes made.
  • Ensure backward compatibility with existing migrations.

User interface changes

There are no direct user interface changes associated with this issue.

API changes

The Drupal\migrate_tools\IdMapFilter::accept() function return type will change to be compatible with FilterIterator::accept(): bool.

The Drupal\migrate_tools\SourceFilter::count() function return type will change to be compatible with Countable::count(): int.

Data model changes

There are no data model changes associated with this issue.

🐛 Bug report
Status

Active

Version

5.2

Component

Code

Created by

🇲🇽Mexico rmontero CMDX

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

Comments & Activities

Production build 0.71.5 2024