Nullable types must be explicit

Created on 5 June 2025, 20 days ago

Problem/Motivation

PHP 8.4 has deprecated implicit nullable types.

Steps to reproduce

Use in a PHP 8.4 environment

πŸ“Œ Task
Status

Active

Version

2.2

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain pcambra Asturies

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @pcambra
  • πŸ‡ͺπŸ‡ΈSpain pcambra Asturies
  • πŸ‡ͺπŸ‡ΈSpain pcambra Asturies
  • Pipeline finished with Failed
    20 days ago
    Total: 165s
    #514989
  • πŸ‡³πŸ‡΄Norway steinmb

    Lets try a keep PHP 8.4 happy, RTBC

  • πŸ‡ΊπŸ‡ΈUnited States Chris Burge

    A number of tests are failing with the following output:

    Test code or tested code printed unexpected output:
    Deprecated: Optional parameter $key_value_factory declared before required parameter $module_handler is implicitly treated as a required parameter in /builds/issue/oembed_providers-3528538/src/OEmbed/ProviderRepositoryDecorator.php on line 116
    Deprecated: Optional parameter $logger_factory declared before required parameter $module_handler is implicitly treated as a required parameter in /builds/issue/oembed_providers-3528538/src/OEmbed/ProviderRepositoryDecorator.php on line 116

    The ProviderRepository constructor change in D10, and the $key_value_factory and $logger_factory parameters are no longer optional: __construct() in D10 vs __construct() in D9.

    D9 is no longer supported by this module, so all we need to do is make the parameters required:

      public function __construct(ProviderRepositoryInterface $decorated, EntityTypeManagerInterface $entity_type_manager, ClientInterface $http_client, ConfigFactoryInterface $config_factory, TimeInterface $time, $key_value_factory, LoggerChannelFactoryInterface $logger_factory, ModuleHandlerInterface $module_handler, $max_age = 604800) {
    
  • First commit to issue fork.
  • Pipeline finished with Success
    7 days ago
    #524934
  • Pipeline finished with Success
    7 days ago
    Total: 277s
    #524939
  • πŸ‡―πŸ‡΅Japan liuyuanchao

    > D9 is no longer supported by this module, so all we need to do is make the parameters required:

    You are right, I change the parameters not nullable, the phpunit passed.
    And by the way, fix phpcs and phpstan warnings.
    Please review.

Production build 0.71.5 2024