Problem/Motivation
Running PHPCS in the GitLab CI reports the following issues:
FILE: ...60/web/modules/custom/migrate_tools-3410760/tests/src/Kernel/DrushTest.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
56 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
57 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
--------------------------------------------------------------------------------
FILE: ...om/migrate_tools-3410760/tests/src/Functional/MigrateExecutionFormTest.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
42 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
43 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
--------------------------------------------------------------------------------
FILE: ...tests/modules/migrate_tools_test/src/Commands/MigrateToolsTestCommands.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
17 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
--------------------------------------------------------------------------------
FILE: ...ules/custom/migrate_tools-3410760/src/MigrateSharedConfigPluginManager.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
50 | ERROR | [x] Missing function doc comment
| | (Drupal.Commenting.FunctionComment.Missing)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...760/web/modules/custom/migrate_tools-3410760/src/MigrateIncludeHandler.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
15 | ERROR | [ ] Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
17 | ERROR | [x] Missing function doc comment
| | (Drupal.Commenting.FunctionComment.Missing)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...3410760/web/modules/custom/migrate_tools-3410760/src/MigrateExecutable.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
85 | ERROR | Missing @var tag in member variable comment
| | (Drupal.Commenting.VariableComment.MissingVar)
--------------------------------------------------------------------------------
FILE: ...60/web/modules/custom/migrate_tools-3410760/src/MigrateBatchExecutable.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------
43 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
44 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
45 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
46 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
--------------------------------------------------------------------------------
FILE: ...60/web/modules/custom/migrate_tools-3410760/src/Routing/RouteProcessor.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
17 | ERROR | [ ] Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
19 | ERROR | [x] Missing function doc comment
| | (Drupal.Commenting.FunctionComment.Missing)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...s/custom/migrate_tools-3410760/src/EventSubscriber/MigrationImportSync.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
22 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
--------------------------------------------------------------------------------
FILE: ...igrate_tools-3410760/src/EventSubscriber/MigrationDrushCommandProgress.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
19 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
20 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
--------------------------------------------------------------------------------
FILE: ...s/custom/migrate_tools-3410760/src/Drush/Commands/MigrateToolsCommands.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
252 | ERROR | The array declaration extends to column 244 (the limit is 120).
| | The array content should be split up over multiple lines
| | (Drupal.Arrays.Array.LongLineDeclaration)
253 | ERROR | The array declaration extends to column 125 (the limit is 120).
| | The array content should be split up over multiple lines
| | (Drupal.Arrays.Array.LongLineDeclaration)
751 | ERROR | The array declaration extends to column 186 (the limit is 120).
| | The array content should be split up over multiple lines
| | (Drupal.Arrays.Array.LongLineDeclaration)
--------------------------------------------------------------------------------
FILE: ...ules/custom/migrate_tools-3410760/src/Discovery/YamlDiscoveryDecorator.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
24 | ERROR | Parameter $file_cache_key_suffix is not described in comment
| | (Drupal.Commenting.FunctionComment.ParamMissingDefinition)
24 | ERROR | Parameter $key is not described in comment
| | (Drupal.Commenting.FunctionComment.ParamMissingDefinition)
29 | ERROR | Doc comment for parameter $name does not match actual variable
| | name $key (Drupal.Commenting.FunctionComment.ParamNameNoMatch)
--------------------------------------------------------------------------------
FILE: ...dules/custom/migrate_tools-3410760/src/Controller/MigrationListBuilder.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
29 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
30 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
31 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
--------------------------------------------------------------------------------
FILE: ...odules/custom/migrate_tools-3410760/src/Controller/MigrationController.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
26 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
27 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
--------------------------------------------------------------------------------
FILE: .../modules/custom/migrate_tools-3410760/src/Controller/MessageController.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
25 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
26 | ERROR | Missing member variable doc comment
| | (Drupal.Commenting.VariableComment.Missing)
--------------------------------------------------------------------------------
FILE: ...ools-3410760/web/modules/custom/migrate_tools-3410760/migrate_tools.module
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
4 | ERROR | [x] Doc comment short description must be on the first line
| | (Drupal.Commenting.DocComment.SpacingBeforeShort)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 679ms; Memory: 12MB
PHP CODE SNIFFER REPORT SUMMARY
--------------------------------------------------------------------------------
FILE ERRORS WARNINGS
--------------------------------------------------------------------------------
...b/modules/custom/migrate_tools-3410760/migrate_tools.module 1 0
...custom/migrate_tools-3410760/src/MigrateBatchExecutable.php 4 0
...ules/custom/migrate_tools-3410760/src/MigrateExecutable.php 1 0
.../custom/migrate_tools-3410760/src/MigrateIncludeHandler.php 2 0
...rate_tools-3410760/src/MigrateSharedConfigPluginManager.php 1 0
.../migrate_tools-3410760/src/Controller/MessageController.php 2 0
...igrate_tools-3410760/src/Controller/MigrationController.php 2 0
...grate_tools-3410760/src/Controller/MigrationListBuilder.php 3 0
...rate_tools-3410760/src/Discovery/YamlDiscoveryDecorator.php 3 0
...e_tools-3410760/src/Drush/Commands/MigrateToolsCommands.php 3 0
...10760/src/EventSubscriber/MigrationDrushCommandProgress.php 2 0
...e_tools-3410760/src/EventSubscriber/MigrationImportSync.php 1 0
...custom/migrate_tools-3410760/src/Routing/RouteProcessor.php 2 0
...igrate_tools_test/src/Commands/MigrateToolsTestCommands.php 1 0
...s-3410760/tests/src/Functional/MigrateExecutionFormTest.php 2 0
...custom/migrate_tools-3410760/tests/src/Kernel/DrushTest.php 2 0
--------------------------------------------------------------------------------
A TOTAL OF 32 ERRORS AND 0 WARNINGS WERE FOUND IN 43 FILES
--------------------------------------------------------------------------------
PHPCBF CAN FIX 4 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
----------------------------------------------------------------------
SOURCE COUNT
----------------------------------------------------------------------
[ ] Drupal.Commenting.VariableComment.Missing 21
[ ] Drupal.Arrays.Array.LongLineDeclaration 3
[x] Drupal.Commenting.FunctionComment.Missing 3
[ ] Drupal.Commenting.FunctionComment.ParamMissingDefinition 2
[x] Drupal.Commenting.DocComment.SpacingBeforeShort 1
[ ] Drupal.Commenting.FunctionComment.ParamNameNoMatch 1
[ ] Drupal.Commenting.VariableComment.MissingVar 1
----------------------------------------------------------------------
A TOTAL OF 32 SNIFF VIOLATIONS WERE FOUND IN 7 SOURCES
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SOURCES AUTOMATICALLY (4 VIOLATIONS IN TOTAL)
----------------------------------------------------------------------
Steps to reproduce
Open job log of the following MR:
https://git.drupalcode.org/issue/migrate_tools-3410760/-/jobs/538852
Verify PHPCS failures.
Proposed resolution
Most of the issues are docblock comments. Fill in the missing comments.
Remaining tasks
Make the change.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comments
Comment #3
lostcarpark commentedPHPCS validation now passing with no issues.
Most of the fixes were adding PHP docblocks.
However, in
src/Drush/Commands/MigrateToolsCommands.phpthe issue was long arrays in PHP attributes.First tried splitting these into multiple lines. This fixed the PHPCS issue, but the PREVIOUS_MAJOR test fails, because attributes not supported by PHP7.4.
Added
// phpcs:disable Drupal.Arrays.Array.LongLineDeclarationto ignore. However, the extra comment made PHPCS think the DocBlock was missing, so had to add// phpcs:disable Drupal.Commenting.FunctionComment.Missing, Squiz.WhiteSpace.FunctionSpacing.Beforeto the function declaration to suppress that warning.Hopefully, support for D9 will eventually be dropped from the module, and at that point we should tidy this up.
Comment #4
lostcarpark commentedComment #5
hetal.solankiI have tested MR 53, and i have found some errors below:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/migrate_tools-3411051/
FILE: /var/www/html/drupal-contribution-d10/web/modules/contrib/migrate_tools-3411051/src/Drush/Commands/MigrateToolsCommands.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 4 WARNINGS AFFECTING 8 LINES
------------------------------------------------------------------------------------------------------------------------------------------
114 | WARNING | Unused variable $group.
481 | WARNING | Unused variable $group_id.
584 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
682 | ERROR | The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
758 | ERROR | The array declaration extends to column 102 (the limit is 80). The array content should be split up over multiple lines
863 | ERROR | The array declaration extends to column 88 (the limit is 80). The array content should be split up over multiple lines
867 | ERROR | The array declaration extends to column 94 (the limit is 80). The array content should be split up over multiple lines
1072 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/drupal-contribution-d10/web/modules/contrib/migrate_tools-3411051/src/MigrateBatchExecutable.php
--------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------
300 | WARNING | Unused variable $migration_id.
--------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/drupal-contribution-d10/web/modules/contrib/migrate_tools-3411051/src/Form/MigrationExecuteForm.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
169 | ERROR | The array declaration extends to column 94 (the limit is 80). The array content should be split up over multiple lines
--------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/drupal-contribution-d10/web/modules/contrib/migrate_tools-3411051/tests/modules/migrate_shared_config_test/migrate_shared_config_test.info.yml
------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | WARNING | "Description" property is missing in the info.yml file
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Comment #6
vinmayiswamy commentedI have tested MR !53 in Drupal version 10.2.x, and confirmed it fixes all the errors reported by phpcs. But we still have a few warnings in the
/src/Controller/MigrationController.phpfile.Thanks!
Comment #8
chandansha commentedi have tested MR 53. i FOUND SOME WARNING. i fixed all of warning using PHPCBF COMMAND.
Thanks!!
Comment #9
hetal.solankiComment #10
vishwenderbaloria commentedI tested with MR 53. Found these errors. Please check
Comment #14
heddnComment #16
klausiThanks! Can you make a new migrate_tools release to get the PHP 8.4 deprecation fix included here out?
Comment #17
jsacksick commented+1: would be great to have a new release containing the PHP 8.4 deprecation fix.
Comment #18
m.stenta+1 for a new release as well! This is causing our PHPUnit tests to fail on PHP 8.4.
Comment #19
m.stentaCross-linking related issue in migrate_plus: #3508679: PHP 8.4 implicit nullable deprecation
Comment #20
m.stentaOops linked to this issue by mistake!
Comment #21
mrshowermanThis introduced a backwards incompatible change in the
MigrateExecutableclass constructor.Now the following
fails with this error:
Comment #22
mgaskey commentedAs mentioned in #21, these changes included adding parameters to the constructor function. Why would fixing PHPCS issues include such a fundamental change? I added a bug ticket here: https://www.drupal.org/node/3411051
Comment #23
xurizaemonLinking #3536657: New parameters introduced in MigrateExecutable class constructor (likely intended link for last comment)