Problem/Motivation
This broke my extension classes. ViewsBulkOperationsActionBase::executeMultiple() had its return type tightened. LLM helped me write the summary of the break.
// 4.4.5
public function executeMultiple(array $objects) { ... }
// 4.4.6+ (introduced in commit "#3589897: General cleanup", carried into 4.4.7)
public function executeMultiple(array $objects): array { ... }
Why it's a hard fatal, not a warning: my_module/src/Plugin/Action/DownloadActionBase.php extends ViewsBulkOperationsActionBase and overrides executeMultiple(array $entities) with no return type. PHP enforces return-type covariance between parent and child at class-declaration time, so as soon as this class is loaded, PHP throws:
Fatal error: Declaration of Drupal\my_module\Plugin\Action\DownloadActionBase::executeMultiple(array $entities)
must be compatible with Drupal\views_bulk_operations\Action\ViewsBulkOperationsActionBase::executeMultiple(array $objects): array
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork views_bulk_operations-3612594
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 #2
graber commentedThank you for reporting, we should deprecate missing return type now and add it in the next major to the API.
Here’s a deprecated return type trait pattern:
Comment #4
graber commentedComment #6
graber commented