Fix PHP 8.4 implicit nullable deprecation

Created on 22 November 2024, 7 months ago

Problem/Motivation

PHP 8.4 has been released, and this module is triggering a "use explicit nullable type" deprecation.

This is part of Drupal's coding standards now, but since the issues to fix phpcs in this module have stalled, I'm opening up this issue to fix this single deprecation to avoid the warnings on PHP 8.4.

After updating to PHP 8.4:

Deprecated: Drupal\pathauto\Commands\PathautoCommands::generateAliases(): Implicitly marking parameter $types as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/pathauto/src/Commands/PathautoCommands.php on line 89
PHP Deprecated:  Drupal\pathauto\Commands\PathautoCommands::deleteAliases(): Implicitly marking parameter $types as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/pathauto/src/Commands/PathautoCommands.php on line 135

Deprecated: Drupal\pathauto\Commands\PathautoCommands::deleteAliases(): Implicitly marking parameter $types as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/pathauto/src/Commands/PathautoCommands.php on line 135
PHP Deprecated:  Drupal\pathauto\AliasStorageHelper::__construct(): Implicitly marking parameter $entity_type_manager as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/pathauto/src/AliasStorageHelper.php on line 79

Deprecated: Drupal\pathauto\AliasStorageHelper::__construct(): Implicitly marking parameter $entity_type_manager as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/web/modules/contrib/pathauto/src/AliasStorageHelper.php on line 79
PHP Deprecated:  Consolidation\AnnotatedCommand\State\StateHelper::injectIntoCallbackObject(): Implicitly marking parameter $output as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/consolidation/annotated-command/src/State/StateHelper.php on line 20
🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇯🇵Japan ptmkenny

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

Merge Requests

Comments & Activities

  • Issue created by @ptmkenny
  • Merge request !91fix implicit nullable deprecations → (Open) created by ptmkenny
  • Pipeline finished with Success
    7 months ago
    #346642
  • 🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

    I have reviewed the MR !91 and its working fine after upgrade to the php 8.4 version.

  • Status changed to RTBC 5 months ago
  • 🇩🇰Denmark ressa Copenhagen

    Thanks for working on this, tagging with PHP 8.4, to easier follow along.

  • 🇦🇹Austria klausi 🇦🇹 Vienna

    Uploading stable patch file for composer patches.

  • is the patch included now ? because ma getting some warnings regarding same issue
    Drupal version = 11.1.7
    pathauto version = 8.x-1.13
    php version = 8.4.7

    
    Deprecated function: Drupal\pathauto\AliasStorageHelper::__construct(): Implicitly marking parameter $entity_type_manager as nullable is deprecated, the explicit nullable type must be used instead in include() (line 576 of /var/www/html/drpee/vendor/composer/ClassLoader.php).
    
    include() (Line: 576)
    {closure:Composer\Autoload\ClassLoader::initializeIncludeClosure():575}() (Line: 427)
    Composer\Autoload\ClassLoader->loadClass() (Line: 259)
    Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
    Drupal\Component\DependencyInjection\Container->get() (Line: 430)
    Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
    Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
    Drupal\Component\DependencyInjection\Container->get() (Line: 75)
    Drupal\pathauto\Form\PathautoSettingsForm::create() (Line: 36)
    Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (Line: 48)
    Drupal\Core\Controller\HtmlFormController->getFormObject() (Line: 58)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}() (Line: 593)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}() (Line: 183)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
    
    
    
Production build 0.71.5 2024