PHP 8.1 Deprecated function: Return type of IdMapFilter::accept() && Return type of Drupal\migrate_tools\SourceFilter::count()

Created on 29 June 2022, about 2 years ago
Updated 27 March 2023, over 1 year ago

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

πŸ“Œ Task
Status

Closed: won't fix

Version

5.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia Mingsong πŸ‡¦πŸ‡Ί

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024