Problem/Motivation
Getting following error/warnings
FILE: /app/modules/contrib/duration_field/README.md
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/duration_field.install
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
17 | WARNING | Unused variable $config_factory.
124 | WARNING | Unused variable $entity_field_manager.
----------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/duration_field.module
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
95 | WARNING | Unused variable $table.
----------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/src/Element/DurationElement.php
-------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/src/Exception/InvalidDurationException.php
-------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/src/Plugin/DataType/DateIntervalData.php
-------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php
-----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
236 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/src/Plugin/Field/FieldWidget/DurationWidget.php
-----------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------
83 | ERROR | [x] Use null coalesce operator instead of ternary operator.
84 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/src/Service/DurationService.php
-------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/src/Service/DurationServiceInterface.php
-------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/tests/modules/duration_field_form_test/duration_field_form_test.info.yml
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
8 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/tests/modules/duration_field_form_test/duration_field_form_test.routing.yml
---------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------
6 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
---------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/tests/modules/duration_field_form_test/src/Form/DurationElementStatesTestForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
43 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/tests/src/Functional/DurationFieldFunctionalTest.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
238 | ERROR | The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
--------------------------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/tests/src/Kernel/DurationFormElementTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
82 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
173 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/duration_field/tests/src/Unit/Service/DurationServiceTest.php
-------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------
Time: 4.14 secs; Memory: 12MB
Steps to reproduce
Run following command
phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/duration_field/
Proposed resolution
Above error/warnings need to be fixed