Problem/Motivation

The error seems to occur with content types that have Address and OfficeHours fields.

ENV:Drupal 10.3.6, php 8.3.12, Address 2.0.2, Office Hours 8.x-1.19

Thank you.

Steps to reproduce

Access admin/config/content/diff/fields:

Fatal error: Declaration of Drupal\office_hours\Plugin\diff\Field\OfficeHoursFieldDiffBuilder::build(Drupal\Core\Field\FieldItemListInterface $items) must be compatible with Drupal\diff\FieldDiffBuilderInterface::build(Drupal\Core\Field\FieldItemListInterface $field_items): mixed in /app/web/modules/contrib/office_hours/src/Plugin/diff/Field/OfficeHoursFieldDiffBuilder.php on line 25

Diff display of specific content with layout “Split fields” and “Unified Fields”, "Visual inline" is fine.

Fatal error: Declaration of Drupal\address\Plugin\diff\Field\AddressFieldBuilder::build(Drupal\Core\Field\FieldItemListInterface $field_items) must be compatible with Drupal\diff\Plugin\diff\Field\CoreFieldBuilder::build(Drupal\Core\Field\FieldItemListInterface $field_items): array in /app/web/modules/contrib/address/src/Plugin/diff/Field/AddressFieldBuilder.php on line 24

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#3 3480456.patch609 bytesconnbi

Issue fork diff-3480456

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

s-jack created an issue. See original summary.

kishan@kk made their first commit to this issue’s fork.

connbi’s picture

StatusFileSize
new609 bytes

I'm not sure if I should modify the FieldDiffBuilderInterface like this.
I deleted the mixed return.

pearls’s picture

Thanks for patch but it didn't work for me because I also have two similar errors from two separate modules.
I'm not sure if a separate integration is needed for each relevant module.

Dynamic Entity Reference Module

Fatal error: Declaration of Drupal\dynamic_entity_reference\Plugin\diff\Field\DynamicEntityReferenceFieldBuilder::build(Drupal\Core\Field\FieldItemListInterface $field_items) must be compatible with Drupal\diff\Plugin\diff\Field\EntityReferenceFieldBuilder::build(Drupal\Core\Field\FieldItemListInterface $field_items): array in /var/www/html/d10site/web/modules/contrib/dynamic_entity_reference/src/Plugin/diff/Field/DynamicEntityReferenceFieldBuilder.php on line 25

Smart Date Module

Fatal error: Declaration of Drupal\smart_date\Plugin\diff\Field\SmartdateFieldBuilder::buildConfigurationForm(array $form, Drupal\Core\Form\FormStateInterface $form_state) must be compatible with Drupal\diff\FieldDiffBuilderBase::buildConfigurationForm(array $form, Drupal\Core\Form\FormStateInterface $form_state): array in /var/www/html/d10site/web/modules/contrib/smart_date/src/Plugin/diff/Field/SmartdateFieldBuilder.php on line 63

There's a solution for smart date here. Fix diff 2.x integration
But if there is a possibility of getting this similar error in different modules, it would be better to approach the situation on a diff basis.

acbramley’s picture

Status: Active » Closed (outdated)

When 2.x was published I created issues for every module with the fixes. All modules seem to have committed these.

Please open issues in the relevant module if they still need fixing.