Problem/Motivation

After upgrading to PHP 8.1, our sites got the PHP warning message said

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 include() (line 13 of /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 include() (line 12 of /app/web/modules/contrib/migrate_tools/src/SourceFilter.php)

Steps to reproduce

  1. Upgrade PHP to 8.1.5
  2. Install migrate_tools 5.1.0

Proposed resolution

Use the #[\ReturnTypeWillChange] attribute to temporarily suppress the notice.

Remaining tasks

Test scripts.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

CommentFileSizeAuthor
#9 3293227_7.patch1.02 KBanouar_dhawadi
#6 3293227_6.patch1.44 KBjoshua1234511
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Mingsong created an issue. See original summary.

mingsong’s picture

Issue tags: +PHP 8.1

mingsong’s picture

Status: Active » Needs review
joshua1234511’s picture

Title: PHP 8.1 Deprecated function: Return type of IdMapFilter::accept() » PHP 8.1 Deprecated function: Return type of IdMapFilter::accept() && Return type of Drupal\migrate_tools\SourceFilter::count()
Issue summary: View changes
joshua1234511’s picture

StatusFileSize
new1.44 KB

Attached patch to use with project

berliner’s picture

Patch applies properly on Drupal 9.4 and get's rid of the deprecation messages. RTBC from my side, but let's wait for at least one other reviewer.

heddn’s picture

Version: 8.x-5.1 » 8.x-5.x-dev
Status: Needs review » Closed (won't fix)

If you want PHP 8.1 support, upgrade to 6.0

anouar_dhawadi’s picture

StatusFileSize
new1.02 KB