- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
@catch also surfaced this again at #3278431-43: Use PHP 8 constructor property promotion β . Bumping to and adding relevant tags.
To be able to reorder class constructor parameters any time, PHP 8 new named arguments feature should be used every time (when "calling a constructor") when creating a class instance.
That would allow more flexible constructor modifications, and eliminate most of the issues when parameter is added/removed/changed. For example problem like "Optional parameter is provided before required" can be fully fixed.
-
for example NodeForm.php create function would be:
public static function create(ContainerInterface $container) {
return new static(
entity_repository: $container->get('entity.repository'),
temp_store_factory: $container->get('tempstore.private'),
entity_type_bundle_info: $container->get('entity_type.bundle.info'),
time: $container->get('datetime.time'),
current_user: $container->get('current_user'),
date_formatter: $container->get('date.formatter')
);
}
Fixing bad parameter names and parameter reordering could be part of the solution (child issues).
Create child issues per ?module
None
Constructors are not part of the API (currently)
-
todo
Active
11.0 π₯
Last updated
The issue particularly affects sites running on PHP version 8.0.0 or later.
Enhances developer experience.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
@catch also surfaced this again at #3278431-43: Use PHP 8 constructor property promotion β . Bumping to and adding relevant tags.