Problem/Motivation
A fatal error occurs due to an incompatible method signature between DynamicEntityReferenceFieldBuilder and its parent class EntityReferenceFieldBuilder.
Steps to reproduce
- Install and enable the dynamic_entity_reference module
- Install and enable the diff module
- Trigger a diff operation on an entity with a dynamic entity reference field
Proposed resolution
Update the method signature in:
modules/contrib/dynamic_entity_reference/src/Plugin/diff/Field/DynamicEntityReferenceFieldBuilder.php
From: public function build(FieldItemListInterface $field_items)
To: public function build(FieldItemListInterface $field_items): array
Issue fork dynamic_entity_reference-3579688
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:
- 3579688-fatal-error-method
compare
- fatal-error-method
changes, plain diff MR !50
Comments
Comment #2
larowlanTagging for a novice as this sounds like a good first contribution
Comment #6
sapnil_biswas commentedI took a look at this while trying to work through the issue, and it seems this may already be resolved on the 3.x branch.
The method in DynamicEntityReferenceFieldBuilder already has the compatible signature with the : array return type, so from what I can tell the fatal error described here has already been addressed in branch code.
I’m still quite new to contributing, so apologies if I’m overlooking something, but I wanted to share what I found in case it is helpful. It may be that the fix is present in the branch but not yet available in the latest release.
Comment #7
sapnil_biswas commentedI revisited the issue after the discussion, and from what I can see, the method signature in the 4.x branch already seems to match the expected implementation. Because of that, I’m currently not able to identify a clear fix needed specifically for 4.x.
It might be possible that the reported error is coming from an older release or a different branch. Would it be possible to confirm the exact version where this issue is occurring?
I’m still getting familiar with the workflow here, so please let me know if I might be missing something or looking in the wrong place. Happy to investigate further!
Comment #8
larowlanThanks @sapnil_biswas! Marking as postponed needs more information in the meantime.