Problem/Motivation

While running it, I'm receiving this error almost to any module while processing:

[error]  Error: Call to undefined method Drupal\upgrade_status\DeprecationMessage::setFile() in Drupal\upgrade_status\LibraryDeprecationAnalyzer->analyzeLibraryDependencies() (line 150 of /var/www/html/web/modules/contrib/upgrade_status/src/LibraryDeprecationAnalyzer.php) #0 /var/www/html/web/modules/contrib/upgrade_status/src/LibraryDeprecationAnalyzer.php(96): Drupal\upgrade_status\LibraryDeprecationAnalyzer->analyzeLibraryDependencies()
#1 /var/www/html/web/modules/contrib/upgrade_status/src/DeprecationAnalyzer.php(456): Drupal\upgrade_status\LibraryDeprecationAnalyzer->analyze()
#2 /var/www/html/web/modules/contrib/upgrade_status/src/Drush/Commands/UpgradeStatusCommands.php(394): Drupal\upgrade_status\DeprecationAnalyzer->analyze()
#3 /var/www/html/web/modules/contrib/upgrade_status/src/Drush/Commands/UpgradeStatusCommands.php(137): Drupal\upgrade_status\Drush\Commands\UpgradeStatusCommands->doAnalyze()
#4 [internal function]: Drupal\upgrade_status\Drush\Commands\UpgradeStatusCommands->analyze()
#5 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#6 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#7 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#8 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(389): Consolidation\AnnotatedCommand\CommandProcessor->process()
#9 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#10 /var/www/html/vendor/symfony/console/Application.php(1121): Symfony\Component\Console\Command\Command->run()
#11 /var/www/html/vendor/drush/drush/src/Application.php(201): Symfony\Component\Console\Application->doRunCommand()
#12 /var/www/html/vendor/symfony/console/Application.php(324): Drush\Application->doRunCommand()
#13 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#14 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(113): Symfony\Component\Console\Application->run()
#15 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#16 /var/www/html/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run()
#17 /var/www/html/vendor/bin/drush.php(119): include('...')
#18 {main}.

I was checking the Class: upgrade_status/src/DeprecationMessage.php
And it really does not have that method so I'm not sure why the Class upgrade_status/src/LibraryDeprecationAnalyzer.php calls it after checking if is an instance DeprecationMessage:

            if ($is_deprecated instanceof DeprecationMessage) {
              $is_deprecated->setFile($file->getPathName());
              $deprecations[] = $is_deprecated;
            }

Versions:
PHP: 8.3
drupal/core: 10.6.12
drupal/core-dev: 10.6.12
drupal/upgrade_status: 4.3.10

Modules I notice the issue:
addtocal
better_exposed_filters
better_social_sharing_buttons
bootstrap_styles.

I stop trying to add modules to ignore so I stop scanning, maybe more modules would trigger it.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

aurora.luzzardi created an issue. See original summary.

aurora.luzzardi’s picture

It seems that this commit: https://git.drupalcode.org/project/upgrade_status/-/commit/886b95ee359e5... removed setFile and setLine as phpcs did not found directly pointing to it, but probably they it have some usage.

gábor hojtsy made their first commit to this issue’s fork.

gábor hojtsy’s picture

setLine indeed does not seem to be used. setFile is though

$ grep -r setFile *
src/LibraryDeprecationAnalyzer.php:            $is_deprecated->setFile($file);
src/LibraryDeprecationAnalyzer.php:          $is_deprecated->setFile($extension->getFilename());
src/LibraryDeprecationAnalyzer.php:          $is_deprecated->setFile($extension->getFilename());
src/LibraryDeprecationAnalyzer.php:              $is_deprecated->setFile($name);
src/LibraryDeprecationAnalyzer.php:              $is_deprecated->setFile($file->getPathName());

I'm wondering why we had no test coverage of those cases, are they for older Drupal versions?!

gábor hojtsy’s picture

Status: Active » Reviewed & tested by the community

Ok test only properly fails, fix with test works. Looks good. Thanks for reporting!

  • gábor hojtsy committed 4ec48e04 on 5.x
    fix: #3607698 Fatal error: Call to undefined method DeprecationMessage::...
gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

gábor hojtsy’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.