Fix issues reported by PHPCS

Created on 6 March 2025, 30 days ago

Problem/Motivation

It would be great to address the below minor PHPCS issues :

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml default_content_deploy/

FILE: ...b/modules/contrib/default_content_deploy/modules/search_api_default_content_deploy/src/Plugin/search_api/backend/DefaultContentDeployBackend.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------
  11 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
 146 | WARNING | [ ] Line exceeds 80 characters; contains 99 characters
------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: ...web/modules/contrib/default_content_deploy/modules/search_api_default_content_deploy/src/EventSubscriber/DefaultContentDeployEventSubscriber.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------
 18 | ERROR   | Missing member variable doc comment
 31 | ERROR   | Doc comment is empty
 38 | ERROR   | Doc comment is empty
 48 | ERROR   | Doc comment is empty
 54 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 56 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/modules/search_api_default_content_deploy/search_api_default_content_deploy.module
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------------
 12 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\search_api\IndexInterface.
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
  45 | WARNING | Line exceeds 80 characters; contains 81 characters
  69 | WARNING | Line exceeds 80 characters; contains 83 characters
  71 | WARNING | Line exceeds 80 characters; contains 89 characters
 195 | WARNING | Line exceeds 80 characters; contains 135 characters
 312 | WARNING | Line exceeds 80 characters; contains 104 characters
----------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/DefaultContentDeployMetadataService.php
-----------------------------------------------------------------------------------------------------
FOUND 13 ERRORS AFFECTING 12 LINES
-----------------------------------------------------------------------------------------------------
   7 | ERROR | Doc comment is empty
  19 | ERROR | Class property $current_uuid should use lowerCamel naming without underscores
  19 | ERROR | Missing member variable doc comment
  35 | ERROR | Doc comment is empty
  47 | ERROR | Doc comment is empty
  56 | ERROR | Doc comment is empty
  63 | ERROR | Doc comment is empty
  70 | ERROR | Doc comment is empty
  77 | ERROR | Doc comment is empty
  84 | ERROR | Doc comment is empty
  91 | ERROR | Doc comment is empty
  98 | ERROR | Doc comment is empty
 105 | ERROR | Doc comment is empty
-----------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/EntityResolver/UuidResolver.php
-----------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------
 22 | ERROR | [ ] Parameter $metadata_service is not described in comment
 28 | ERROR | [x] Expected 1 space between type hint and argument "$metadata_service"; 2 found
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/ExporterInterface.php
---------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
---------------------------------------------------------------------------------------------------------------------
  52 | ERROR   | Missing short description in doc comment
  86 | ERROR   | Doc comment short description must end with a full stop
  86 | ERROR   | Doc comment short description must be on a single line, further text should be a separate paragraph
  94 | WARNING | Line exceeds 80 characters; contains 84 characters
  96 | ERROR   | Missing parameter comment
 101 | WARNING | Line exceeds 80 characters; contains 84 characters
---------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Form/SettingsForm.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 6 WARNINGS AFFECTING 8 LINES
---------------------------------------------------------------------------------------------------------------------------------------
   8 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
  84 | WARNING | [ ] #description values usually have to run through t() for translation
  91 | WARNING | [ ] #description values usually have to run through t() for translation
  98 | WARNING | [ ] #description values usually have to run through t() for translation
 104 | ERROR   | [ ] Doc comment is empty
 112 | WARNING | [ ] #description values usually have to run through t() for translation
 120 | WARNING | [ ] #description values usually have to run through t() for translation
 127 | WARNING | [ ] #description values usually have to run through t() for translation
---------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Form/ExportForm.php
---------------------------------------------------------------------------------
FOUND 16 ERRORS AFFECTING 13 LINES
---------------------------------------------------------------------------------
  50 | ERROR | Missing parameter comment
  51 | ERROR | Missing parameter comment
  52 | ERROR | Missing parameter comment
  53 | ERROR | Missing parameter comment
  54 | ERROR | Missing parameter comment
 197 | ERROR | Missing parameter comment
 197 | ERROR | Missing parameter type
 198 | ERROR | Missing parameter comment
 200 | ERROR | Description for the @return value is missing
 219 | ERROR | Missing parameter comment
 219 | ERROR | Missing parameter type
 220 | ERROR | Missing parameter comment
 222 | ERROR | Description for the @return value is missing
 309 | ERROR | Missing parameter comment
 309 | ERROR | Missing parameter type
 311 | ERROR | Description for the @return value is missing
---------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Form/ImportForm.php
---------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
---------------------------------------------------------------------------------
 42 | ERROR | Missing parameter comment
 43 | ERROR | Missing parameter comment
 44 | ERROR | Missing parameter comment
 45 | ERROR | Missing parameter comment
---------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Queue/DefaultContentDeployBatch.php
-------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------
 15 | WARNING | There must be no blank line following an inline comment
 17 | ERROR   | Doc comment is empty
 22 | ERROR   | Doc comment is empty
-------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Event/PostSerializeEvent.php
-----------------------------------------------------------------------------------------------------------------
FOUND 12 ERRORS AND 1 WARNING AFFECTING 13 LINES
-----------------------------------------------------------------------------------------------------------------
  9 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
 12 | ERROR   | Missing member variable doc comment
 13 | ERROR   | Missing member variable doc comment
 14 | ERROR   | Missing member variable doc comment
 15 | ERROR   | Missing member variable doc comment
 24 | ERROR   | Missing short description in doc comment
 25 | ERROR   | Description for the @return value is missing
 31 | ERROR   | Doc comment is empty
 38 | ERROR   | Doc comment is empty
 45 | ERROR   | Doc comment is empty
 55 | ERROR   | Doc comment is empty
 65 | ERROR   | Doc comment is empty
 72 | ERROR   | Doc comment is empty
-----------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Event/PreSerializeEvent.php
-----------------------------------------------------------------------------------------------------------------
FOUND 14 ERRORS AND 1 WARNING AFFECTING 14 LINES
-----------------------------------------------------------------------------------------------------------------
  9 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
 12 | ERROR   | Missing member variable doc comment
 13 | ERROR   | Missing member variable doc comment
 14 | ERROR   | Missing member variable doc comment
 16 | ERROR   | Missing short description in doc comment
 16 | ERROR   | Parameter $folder is not described in comment
 17 | ERROR   | Missing parameter comment
 18 | ERROR   | Missing parameter comment
 26 | ERROR   | Missing short description in doc comment
 27 | ERROR   | Description for the @return value is missing
 33 | ERROR   | Missing short description in doc comment
 34 | ERROR   | Missing parameter comment
 40 | ERROR   | Doc comment is empty
 47 | ERROR   | Doc comment is empty
 54 | ERROR   | Doc comment is empty
-----------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Event/IndexAwareEventInterface.php
------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------
  5 | ERROR | Doc comment is empty
 10 | ERROR | Doc comment is empty
 15 | ERROR | Doc comment is empty
------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Event/ImportBatchFinishedEvent.php
-----------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 8 LINES
-----------------------------------------------------------------------------------------------------------------
  7 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
 10 | ERROR   | Missing member variable doc comment
 11 | ERROR   | Missing member variable doc comment
 13 | ERROR   | Missing short description in doc comment
 14 | ERROR   | Missing parameter comment
 15 | ERROR   | Missing parameter comment
 22 | ERROR   | Doc comment is empty
 29 | ERROR   | Doc comment is empty
-----------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Event/IndexAwareEvent.php
-----------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
-----------------------------------------------------------------------------------------------------------------
  9 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
 12 | ERROR   | Missing member variable doc comment
 14 | ERROR   | Doc comment is empty
 21 | ERROR   | Doc comment is empty
-----------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/AdministratorTrait.php
------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------
  9 | ERROR | Doc comment is empty
 28 | ERROR | Missing short description in doc comment
 29 | ERROR | Description for the @return value is missing
------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Controller/DownloadController.php
-----------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------
 39 | ERROR | Parameter $event_dispatcher is not described in comment
 67 | ERROR | Description for the @return value is missing
-----------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/DeployManager.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 6 LINES
-------------------------------------------------------------------------------------------------------------------------------------
   7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
  13 | ERROR | [ ] Doc comment is empty
  78 | ERROR | [ ] Missing parameter type
  80 | ERROR | [ ] Missing parameter type
 147 | ERROR | [ ] Description for the @return value is missing
 173 | ERROR | [ ] Missing parameter comment
 173 | ERROR | [ ] Missing parameter type
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Commands/DefaultContentDeployCommands.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 12 ERRORS AND 2 WARNINGS AFFECTING 14 LINES
------------------------------------------------------------------------------------------------------------------------------------------
  18 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
  71 | ERROR   | Missing short description in doc comment
  78 | ERROR   | Missing short description in doc comment
  88 | ERROR   | Missing parameter type
 124 | ERROR   | The array declaration extends to column 245 (the limit is 120). The array content should be split up over multiple lines
 203 | ERROR   | The array declaration extends to column 316 (the limit is 120). The array content should be split up over multiple lines
 288 | ERROR   | The array declaration extends to column 198 (the limit is 120). The array content should be split up over multiple lines
 346 | ERROR   | The array declaration extends to column 173 (the limit is 120). The array content should be split up over multiple lines
 388 | ERROR   | Missing parameter type
 390 | ERROR   | Missing parameter type
 424 | ERROR   | Missing parameter type
 427 | WARNING | Unused private method displayExportResult()
 439 | ERROR   | Missing parameter type
 459 | ERROR   | Description for the @return value is missing
------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Importer.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 16 ERRORS AND 5 WARNINGS AFFECTING 21 LINES
------------------------------------------------------------------------------------------------------------------------------------------
  24 | ERROR   | Doc comment is empty
 152 | ERROR   | Missing short description in doc comment
 178 | ERROR   | Missing short description in doc comment
 428 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 487 | ERROR   | Doc comment is empty
 495 | ERROR   | Doc comment is empty
 503 | ERROR   | Doc comment is empty
 514 | ERROR   | Missing parameter type
 516 | ERROR   | Missing parameter type
 518 | ERROR   | Missing parameter type
 523 | WARNING | Line exceeds 80 characters; contains 93 characters
 569 | WARNING | Line exceeds 80 characters; contains 83 characters
 654 | WARNING | Line exceeds 80 characters; contains 81 characters
 731 | ERROR   | Missing parameter type
 733 | ERROR   | Missing parameter type
 735 | ERROR   | Missing parameter type
 738 | WARNING | Line exceeds 80 characters; contains 93 characters
 805 | ERROR   | Missing short description in doc comment
 840 | ERROR   | The array declaration extends to column 124 (the limit is 120). The array content should be split up over multiple lines
 880 | ERROR   | SWITCH statements must contain at least one CASE statement
 914 | ERROR   | Doc comment short description must be on a single line, further text should be a separate paragraph
------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/src/Exporter.php
-----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 14 ERRORS AND 10 WARNINGS AFFECTING 24 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------
   27 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\layout_builder\Section.
   31 | ERROR   | [ ] Doc comment is empty
  173 | ERROR   | [ ] Missing short description in doc comment
  178 | ERROR   | [ ] Missing member variable doc comment
  194 | ERROR   | [ ] Missing short description in doc comment
  199 | ERROR   | [ ] Missing short description in doc comment
  281 | ERROR   | [ ] Doc comment is empty
  364 | WARNING | [ ] Unused variable $skip_export_timestamp.
  472 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  508 | ERROR   | [ ] Doc comment is empty
  530 | ERROR   | [ ] Doc comment is empty
  537 | ERROR   | [ ] Doc comment is empty
  551 | ERROR   | [ ] Doc comment is empty
  858 | ERROR   | [ ] Doc comment is empty
  973 | ERROR   | [ ] Missing parameter comment
  975 | ERROR   | [ ] Description for the @return value is missing
  992 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
 1027 | WARNING | [ ] Line exceeds 80 characters; contains 101 characters
 1028 | WARNING | [ ] Unused variable $field_key.
 1038 | WARNING | [ ] Unused variable $component_uuid.
 1039 | WARNING | [ ] Line exceeds 80 characters; contains 95 characters
 1096 | WARNING | [ ] Unused variable $key.
 1169 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
 1196 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/web/modules/contrib/default_content_deploy/default_content_deploy.post_update.php
------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------
 3 | ERROR   | Missing short description in doc comment
 8 | WARNING | Line exceeds 80 characters; contains 86 characters
------------------------------------------------------------------------------------------------

Time: 2.08 secs; Memory: 22MB

Steps to reproduce

  • Install the module, composer require 'drupal/default_content_deploy:^2.1'
  • Run the command,

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml default_content_deploy/

Proposed resolution

Fix the PHPCS issues.

📌 Task
Status

Active

Version

2.1

Component

Code

Created by

🇮🇳India abhiyanshu

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024