- Issue created by @carolpettirossi
- Merge request !1363496270: Fix deprecated notice of optional parameters when deleting a registrant. β (Open) created by carolpettirossi
- Status changed to Needs work
about 2 months ago 12:16am 11 July 2025 - πΊπΈUnited States jrb Raleigh-Durham Area, NC, USA
This is actually a problem in 4 different places:
public function __construct(EntityRepositoryInterface $entity_repository, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, ?TimeInterface $time = NULL, Messenger $messenger, Renderer $renderer, RegistrationCreationService $creation_service) {
public function __construct(EntityRepositoryInterface $entity_repository, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, ?TimeInterface $time = NULL, Messenger $messenger, Renderer $renderer, ConfigFactory $config) {
public function __construct(EntityRepositoryInterface $entity_repository, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, ?TimeInterface $time = NULL, Messenger $messenger, DateFormatter $date_formatter) {
TaxonomyIndexTidEventSeriesDepth.php
public function __construct(array $configuration, $plugin_id, $plugin_definition, VocabularyStorageInterface $vocabulary_storage, TermStorageInterface $term_storage, ?AccountInterface $current_user = NULL, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, ?EntityFieldManagerInterface $entity_field_manager = NULL, Connection $database) {
Given that all of these classes are working as they are (I assume), is the best solution to just make all of these optional parameters not optional?
Each class has a
create
method that passes all parameters, so everything should just continue to work, right? - π§π¬Bulgaria pfrenssen Sofia
This is already fixed in the 3.0.x branch as part of π Fix constructors which have incorrectly marked arguments as nullable Active . Changing the order of the arguments is a B/C break which will affect existing projects which extend these forms with customized versions. That was why this was not fixed in 2.0.x.
I think the non-B/C breaking way to solve this is to make the trailing arguments nullable. Then the deprecation warning goes away, and extending code is not affected.
public function __construct(EntityRepositoryInterface $entity_repository, ?EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, ?TimeInterface $time = NULL, ?Messenger $messenger = NULL, // Make trailing arguments nullable. ?DateFormatter $date_formatter = NULL // Make trailing arguments nullable. ) {
I personally think this is not so important to backport to 2.0.x since it is just a deprecation warning and 2.0.x will be unsupported when D10 support ends, so I will close this as a duplicate of π Fix constructors which have incorrectly marked arguments as nullable Active . However if someone deeply cares about this, feel free to reopen the issue!