PHP CodeSniffer PHP 8.4 deprecations

Created on 21 February 2025, about 2 months ago

Problem/Motivation

PHP 8.4 has been released, and this project is triggering deprecations.

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:

FILE: /src/MigrateTools.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
 71 | WARNING | The $escape parameter must be passed when calling str_getcsv() as its default value will change in a future PHP version.
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /src/Drush/Commands/MigrateToolsCommands.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------------------
 805 | WARNING | The $escape parameter must be passed when calling fputcsv() as its default value will change in a future PHP version.
 807 | WARNING | The $escape parameter must be passed when calling fputcsv() as its default value will change in a future PHP version.
---------------------------------------------------------------------------------------------------------------------------------------


FILE: /src/MigrateExecutable.php
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 91 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update the type to be explicitly nullable instead. Found implicitly nullable parameter: $message.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /src/Routing/RouteProcessor.php
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 26 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update the type to be explicitly nullable instead. Found implicitly nullable parameter: $bubbleable_metadata.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
🐛 Bug report
Status

Needs work

Version

6.0

Component

Code

Created by

🇪🇸Spain enchufe Spain

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

Merge Requests

Comments & Activities

  • Issue created by @enchufe
  • Pipeline finished with Success
    about 2 months ago
    Total: 221s
    #430574
  • 🇫🇷France musa.thomas France 🇫🇷

    stil have after apply patch

    Deprecated function: Drupal\migrate_tools\Routing\RouteProcessor::processOutbound(): Implicitly marking parameter $bubbleable_metadata as nullable is deprecated, the explicit nullable type must be used instead in include() (line 576 of /var/www/app/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: 273)
    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: 445)
    Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
    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: 430)
    Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
    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: 454)
    Drupal\Component\DependencyInjection\Container->{closure:Drupal\Component\DependencyInjection\Container::resolveServicesAndParameters():453}() (Line: 243)
    Symfony\Component\EventDispatcher\EventDispatcher::{closure:Symfony\Component\EventDispatcher\EventDispatcher::optimizeListeners():241}() (Line: 206)
    Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
    Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 159)
    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: 50)
    Drupal\ban\BanMiddleware->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)
    
  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    The error in #4 refers to code that is not part of migrate_tools. These changes look good to me.

  • 🇫🇷France musa.thomas France 🇫🇷

    @liam morland sorry but it's literally write "Drupal\migrate_tools\Routing\RouteProcessor::processOutbound(): Implicitly marking parameter $bubbleable_metadata as nullable is deprecated" So what else it can refer to ?

    For me

    public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL):
    should be
    public function processOutbound($route_name, Route $route, array &$parameters, ?BubbleableMetadata $bubbleable_metadata = NULL):

  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    Sorry, I must have mis-read your post. Can you add your change to the merge request?

  • 🇫🇷France musa.thomas France 🇫🇷

    I don't understand cause it's seems already fix in the issue fork the fix is not inside the diff and also I have the 6.0.5 version, I miss something but don't know what

  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    I don't think this issue is needed anymore. The current latest commit on 6.0.x passes all tests, including on max PHP. It looks like everything was fixed in other issues.

Production build 0.71.5 2024