Fix PHPStan and Coding standards issues

Created on 1 May 2023, over 1 year ago
Updated 16 August 2024, 4 months ago

Problem/Motivation

This module largely ignores the use of dependency injection. This should be fixed as well as the rest of the PHPStan and PHPCS issues:

130/130 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ------------------------------------------------------------------------------
  Line   src/Controller/BackupController.php
 ------ ------------------------------------------------------------------------------
  28     \Drupal calls should be avoided in classes, use dependency injection instead
  115    \Drupal calls should be avoided in classes, use dependency injection instead
  116    \Drupal calls should be avoided in classes, use dependency injection instead
  133    \Drupal calls should be avoided in classes, use dependency injection instead
  134    \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Controller/ScheduleListBuilder.php
 ------ ------------------------------------------------------------------------------
  44     \Drupal calls should be avoided in classes, use dependency injection instead
  46     \Drupal calls should be avoided in classes, use dependency injection instead
  47     \Drupal calls should be avoided in classes, use dependency injection instead
  55     \Drupal calls should be avoided in classes, use dependency injection instead
  57     \Drupal calls should be avoided in classes, use dependency injection instead
  73     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Core/Destination/DirectoryDestination.php
 ------ ------------------------------------------------------------------------------
  241    \Drupal calls should be avoided in classes, use dependency injection instead
  246    \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Core/Filter/CompressionFilter.php
 ------ ------------------------------------------------------------------------------
  204    \Drupal calls should be avoided in classes, use dependency injection instead
  257    \Drupal calls should be avoided in classes, use dependency injection instead
  305    \Drupal calls should be avoided in classes, use dependency injection instead
  307    \Drupal calls should be avoided in classes, use dependency injection instead
  312    \Drupal calls should be avoided in classes, use dependency injection instead
  330    \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Core/Filter/FileNamer.php
 ------ ------------------------------------------------------------------------------
  24     \Drupal calls should be avoided in classes, use dependency injection instead
  98     \Drupal calls should be avoided in classes, use dependency injection instead
  99     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Core/Filter/Notify.php
 ------ ------------------------------------------------------------------------------
  45     \Drupal calls should be avoided in classes, use dependency injection instead
  58     \Drupal calls should be avoided in classes, use dependency injection instead
  102    \Drupal calls should be avoided in classes, use dependency injection instead
  114    \Drupal calls should be avoided in classes, use dependency injection instead
  139    \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Core/Service/Mailer.php
 ------ ------------------------------------------------------------------------------
  30     \Drupal calls should be avoided in classes, use dependency injection instead
  31     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Core/Source/MySQLiSource.php
 ------ ------------------------------------------------------------------------------
  48     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Drupal/Destination/DrupalBrowserUploadDestination.php
 ------ ------------------------------------------------------------------------------
  22     \Drupal calls should be avoided in classes, use dependency injection instead
  57     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Drupal/Destination/DrupalDirectoryDestination.php
 ------ ------------------------------------------------------------------------------
  35     \Drupal calls should be avoided in classes, use dependency injection instead
  62     \Drupal calls should be avoided in classes, use dependency injection instead
  72     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Drupal/Environment/DrupalSetMessageLogger.php
 ------ ------------------------------------------------------------------------------
  43     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------
  Line   src/Drupal/Filter/DrupalEncrypt.php
 ------ -----------------------------------------------------------------------------------------
  48     \Drupal calls should be avoided in classes, use dependency injection instead
  74     \Drupal calls should be avoided in classes, use dependency injection instead
  75     \Drupal calls should be avoided in classes, use dependency injection instead
  78     Call to static method encryptFileWithPassword() on an unknown class Defuse\Crypto\File.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
  79     \Drupal calls should be avoided in classes, use dependency injection instead
  83     Caught class Drupal\backup_migrate\Drupal\Filter\Exception not found.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
  92     \Drupal calls should be avoided in classes, use dependency injection instead
  93     \Drupal calls should be avoided in classes, use dependency injection instead
  96     Call to static method decryptFileWithPassword() on an unknown class Defuse\Crypto\File.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
  100    Caught class Drupal\backup_migrate\Drupal\Filter\Exception not found.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
 ------ -----------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Drupal/Filter/DrupalUtils.php
 ------ ------------------------------------------------------------------------------
  75     \Drupal calls should be avoided in classes, use dependency injection instead
  76     \Drupal calls should be avoided in classes, use dependency injection instead
  87     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Drupal/Source/DrupalSiteArchiveSource.php
 ------ ------------------------------------------------------------------------------
  91     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Form/BackupMigrateAdvancedBackupForm.php
 ------ ------------------------------------------------------------------------------
  45     \Drupal calls should be avoided in classes, use dependency injection instead
  48     \Drupal calls should be avoided in classes, use dependency injection instead
  75     \Drupal calls should be avoided in classes, use dependency injection instead
  96     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Form/EntityDeleteForm.php
 ------ ------------------------------------------------------------------------------
  43     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Form/ScheduleDeleteForm.php
 ------ ------------------------------------------------------------------------------
  41     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Form/ScheduleForm.php
 ------ ------------------------------------------------------------------------------
  134    \Drupal calls should be avoided in classes, use dependency injection instead
  140    \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Form/SettingsProfileDeleteForm.php
 ------ ------------------------------------------------------------------------------
  41     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Form/SettingsProfileForm.php
 ------ ------------------------------------------------------------------------------
  63     \Drupal calls should be avoided in classes, use dependency injection instead
  69     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   src/Form/WrapperEntityForm.php
 ------ ------------------------------------------------------------------------------
  88     \Drupal calls should be avoided in classes, use dependency injection instead
  95     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ------------------------------------------------------------------------------

 [ERROR] Found 63 errors

Here are some helpful informations regarding dependency injection:

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs work

Version

5.1

Component

Code

Created by

🇮🇳India Akshay kashyap

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024