Fix backwards-incompatible Json data_parser API change included in 6.0.3.

Created on 19 July 2024, 5 months ago
Updated 22 August 2024, 4 months ago

Problem/Motivation

The changes made to Drupal\migrate_plus\Plugin\migrate_plus\data_parser\Json for 📌 Support paging through multiple requests Needs work included backwards-incompatible API changes (protected method signature changes).

We have a custom module that includes a data_parser plugin that extends the Json plugin. After upgrading migrate_plus to 6.0.3 we saw errors when scanning our custom module code with PHPStan:

------ --------------------------------------------------------------------------------------------------------------------------- 
 Line   modules/custom/custom_module/src/Plugin/migrate_plus/data_parser/CustomJson.php  
------ --------------------------------------------------------------------------------------------------------------------------- 
  20     Method                                                                                                                     
         Drupal\custom_module\Plugin\migrate_plus\data_parser\CustomJson::getSourceData()         
         overrides method                                                                                                           
         Drupal\migrate_plus\Plugin\migrate_plus\data_parser\Json::getSourceData()                                                  
         but misses parameter #2 $item_selector.                                                                                    
  21     Method                                                                                                                     
         Drupal\migrate_plus\Plugin\migrate_plus\data_parser\Json::getSourceData()                                                  
         invoked with 1 parameter, 2 required.                                                                                      
 ------ --------------------------------------------------------------------------------------------------------------------------- 


 [ERROR] Found 2 errors              

Steps to reproduce

Proposed resolution

Set a default value for the new parameter to preserve backwards compatibility.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

6.0

Component

API

Created by

🇺🇸United States joegraduate Arizona, USA

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024