Problem/Motivation

When using MigrateProcessInterface->transfrom() some fields might expect something different than array or string.
Like you can pass to it a mixed value, you should be able to return a mixed value to be processed for another processor or to be added to the field.
The problem is in the comments of the method, so you can really return whatever type of value, but it makes some linting software to fail.

Steps to reproduce

Proposed resolution

Edit comment so it returns a mixed value

Remaining tasks

User interface changes

None

API changes

Technically is an API change since it alters the definition of an interface but since just widens the options in the return is not a braking change.

Data model changes

None

Release notes snippet

CommentFileSizeAuthor
#7 drupal-3240109-2.patch717 bytesquietone
#2 drupal-3240109-2.patch717 bytesedurenye

Comments

edurenye created an issue. See original summary.

edurenye’s picture

Status: Active » Needs review
StatusFileSize
new717 bytes

Fixed

quietone’s picture

Version: 9.2.x-dev » 9.3.x-dev

Seems I was all thumbs trying to get the correct test started.

martin_klima’s picture

Status: Needs review » Reviewed & tested by the community

Yes, I fully agree. The MigrateProcessInterface has a wrong return type for the transform() method.
For example \Drupal\migrate\Plugin\migrate\process\MigrationLookup::transform returns NULL, so it is not compatible with the interface.

I had a problem with PHPstan check because our custom process plugin returns also NULL.

This patch works, thank you!

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

damienmckenna’s picture

Assigned: edurenye » Unassigned

As a reminder, the "assigned" field is for indicating you're actively working on something, when you're finished please set the field back to "unassigned". Thank you.

quietone’s picture

StatusFileSize
new717 bytes

Re-uploading patch so it will test with 9.4.x.

  • catch committed 8313743 on 10.0.x
    Issue #3240109 by edurenye, quietone: When using MigrateProcessInterface...

  • catch committed 8f30563 on 9.4.x
    Issue #3240109 by edurenye, quietone: When using MigrateProcessInterface...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 10.0.x and cherry-picked to 9.4.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.