Incorrect type hint in rdf_sync_entity_bundle_field_info() hook implementation

Created on 13 June 2025, 22 days ago

Problem/Motivation

In rdf_sync.module, the hook_entity_bundle_field_info() implementation incorrectly type-hints both parameters as strings:
function rdf_sync_entity_bundle_field_info(string $entity_type, string $bundle): array {

According to the official Drupal API documentation, this hook may be invoked with $bundle = NULL when Drupal core or contrib modules (such as OG, TMGMT, or EntityFieldManager) attempt to retrieve field definitions for all bundles of a given entity type.

Strictly type-hinting $bundle as string violates Drupal's expected function signature and causes TypeError exceptions in PHP 8+ and Drupal 10/11 environments.

See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...

Proposed resolution

Relax the type hint to allow nullable $bundle:
function rdf_sync_entity_bundle_field_info(string $entity_type, ?string $bundle): array {

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇵🇱Poland alorenc Wolsztyn, 🇵🇱

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