Problem/Motivation
The Liveblog module is experiencing a fatal PHP error when running on Drupal 11 due to an incorrect type declaration in the LiveblogAjaxResponseAttachmentsProcessor class. This appears to be a compatibility issue where the module hasn't been updated to match Drupal 11's stricter type requirements.
Root Cause: Drupal 11 enforces stricter type declarations and the Liveblog module's $assetResolver property declaration doesn't match the required AssetResolverInterface type from the parent class.
Steps to reproduce
- Set up a Drupal 11 site
- Install the Liveblog module via Composer:
composer require drupal/liveblog - Enable the Liveblog module through the admin interface or drush:
drush en liveblog - Navigate to any page on the site
- Observe the fatal error preventing page load
- Check error logs to confirm the type declaration mismatch
Proposed resolution
The issue requires updating the Liveblog module to be compatible with Drupal 11's type system requirements. The immediate fix involves correcting the property type declaration.
Immediate Fix:
Update the $assetResolver property declaration in LiveblogAjaxResponseAttachmentsProcessor.php:
// Current (incorrect) declaration: protected $assetResolver; // Correct declaration for Drupal 11: protected AssetResolverInterface $assetResolver;
Long-term Solution:
- Update the entire Liveblog module for Drupal 11 compatibility
- Add proper type hints throughout the codebase
- Test against Drupal 11's requirements
- Update composer.json to indicate Drupal 11 support
Remaining tasks
- Fix the immediate type declaration in LiveblogAjaxResponseAttachmentsProcessor.php
- Review all class properties and methods for Drupal 11 compatibility
- Update use statements and imports as needed
- Test the module functionality on Drupal 11
- Run automated tests to ensure no regressions
- Update module's composer.json to support Drupal 11
- Update module documentation for Drupal 11
- Create a patch or update the module repository
User interface changes
No user interface changes are expected from this compatibility fix. The changes are purely backend code corrections to resolve the fatal error and ensure the module functions properly on Drupal 11.
API changes
No breaking API changes are expected. The fix maintains backward compatibility while ensuring forward compatibility with Drupal 11. The changes involve:
- Adding proper type declarations to match parent class interfaces
- Ensuring method signatures comply with Drupal 11 standards
- Maintaining existing functionality and method behaviors
Data model changes
No data model changes are required for this compatibility fix. This is purely a code-level correction to resolve type declaration mismatches introduced by Drupal 11's stricter type enforcement requirements.
Issue fork liveblog-3527434
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
Comment #3
abhineshComment #4
abhineshComment #5
a.milkovskyComment #7
abhineshThanks @a.milkovsky
Comment #8
abhineshComment #10
abhinesh