Fix the errors/warnings reported by PHP_CodeSniffer

Created on 12 January 2023, almost 2 years ago
Updated 4 June 2024, 6 months ago

Problem/Motivation

Getting follows errors and warnings

FILE: /app/modules/contrib/key/drush/key_delete.drush.inc
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
20 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/drush/key_list.drush.inc
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
16 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/drush/key_value_get.drush.inc
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
11 | WARNING | [x] 'TODO: Only return the value (without the index),
| | so the label can be' should match the format
| | '@todo Fix problem X here.'
21 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/key.info.yml
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added
| | by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be
| | added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added
| | by drupal.org packaging automatically
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/src/Commands/KeyCommands.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 4 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
18 | WARNING | [ ] The class short comment should describe what the
| | class does and not simply repeat the class name
204 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
244 | ERROR | [ ] The array declaration extends to column 87 (the
| | limit is 80). The array content should be split
| | up over multiple lines
247 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
354 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
----------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...ules/contrib/key/src/Controller/KeyConfigOverrideListBuilder.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
84 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/src/Controller/KeyListBuilder.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------
78 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
98 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
157 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/src/Entity/Key.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
341 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
363 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/src/Entity/KeyConfigOverride.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
142 | WARNING | [x] 'TODO: Get the key entity.' should match the
| | format '@todo Fix problem X here.'
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/src/Form/KeyAddForm.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
11 | WARNING | The class short comment should describe what the
| | class does and not simply repeat the class name
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/src/Form/KeyConfigOverrideAddForm.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------
18 | WARNING | The class short comment should describe what the
| | class does and not simply repeat the class name
300 | ERROR | The array declaration extends to column 111 (the
| | limit is 80). The array content should be split up
| | over multiple lines
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/src/Form/KeyEditForm.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
13 | WARNING | [ ] The class short comment should describe what the
| | class does and not simply repeat the class name
29 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/src/Form/KeyFormBase.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------
86 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
355 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
358 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
382 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
385 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
412 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
415 | WARNING | [x] Inline @var declarations should use the /** */
| | delimiters
----------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/src/KeyConfigOverrideInterface.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
9 | WARNING | The class short comment should describe what the class
| | does and not simply repeat the class name
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/src/KeyConfigOverrides.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
54 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
55 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
73 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
144 | WARNING | Unused variable $id.
----------------------------------------------------------------------

FILE: ...modules/contrib/key/src/Plugin/KeyProvider/ConfigKeyProvider.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
48 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
72 | ERROR | [x] Use null coalesce operator instead of ternary
| | operator.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...app/modules/contrib/key/tests/modules/key_test/key_test.info.yml
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added
| | by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be
| | added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added
| | by drupal.org packaging automatically
----------------------------------------------------------------------

FILE: ...trib/key/tests/modules/key_test/src/Plugin/KeyProvider/State.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
13 | ERROR | [x] There must be exactly one blank line before the
| | tags in a doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/tests/src/Functional/KeyInputTest.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
7 | WARNING | [x] Unused use statement
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...odules/contrib/key/tests/src/Functional/KeyOverrideAdminTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
16 | ERROR | Missing member variable doc comment
----------------------------------------------------------------------

FILE: ...es/contrib/key/tests/src/Functional/KeyRepositoryServiceTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
64 | ERROR | The array declaration extends to column 86 (the limit
| | is 80). The array content should be split up over
| | multiple lines
----------------------------------------------------------------------

FILE: /app/modules/contrib/key/tests/src/Unit/Entity/KeyEntityTest.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
44 | ERROR | Class property $key_type_settings should use
| | lowerCamel naming without underscores
52 | ERROR | Class property $key_provider_settings should use
| | lowerCamel naming without underscores
60 | ERROR | Class property $key_input_settings should use
| | lowerCamel naming without underscores
111 | ERROR | The array declaration extends to column 99 (the limit
| | is 80). The array content should be split up over
| | multiple lines
----------------------------------------------------------------------

Time: 2.95 secs; Memory: 14MB

Steps to reproduce

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

Proposed resolution

Do appropriate changes.
Verify if the changes are not breaking any functionalities.

📌 Task
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇮🇳India shivam-kumar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Needs work over 1 year ago
  • 🇵🇭Philippines paraderojether

    I applied patch #4 againts Key version 8.x-1.x-dev, and there are still phpcs remaining issue shown below:

    FILE: ...Drupal.org/drupalorg-site/docroot/modules/contrib/key/tests/src/Unit/Entity/KeyEntityTest.php
    ---------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    ---------------------------------------------------------------------------------------------------
      44 | ERROR | Class property $key_type_settings should use lowerCamel naming without underscores
      52 | ERROR | Class property $key_provider_settings should use lowerCamel naming without
         |       | underscores
      60 | ERROR | Class property $key_input_settings should use lowerCamel naming without underscores
     111 | ERROR | The array declaration extends to column 99 (the limit is 80). The array content
         |       | should be split up over multiple lines
    ---------------------------------------------------------------------------------------------------
    
    
    FILE: ....org/drupalorg-site/docroot/modules/contrib/key/tests/src/Functional/KeyOverrideAdminTest.php
    ---------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------
     16 | ERROR | Missing member variable doc comment
    ---------------------------------------------------------------------------------------------------
    
    
    FILE: .../drupalorg-site/docroot/modules/contrib/key/tests/src/Functional/KeyRepositoryServiceTest.php
    ---------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------
     64 | ERROR | The array declaration extends to column 86 (the limit is 80). The array content
        |       | should be split up over multiple lines
    ---------------------------------------------------------------------------------------------------
    
    
    FILE: ...nees/Drupal.org/drupalorg-site/docroot/modules/contrib/key/src/KeyConfigOverrideInterface.php
    ---------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------
     9 | WARNING | The class short comment should describe what the class does and not simply repeat
       |         | the class name
    ---------------------------------------------------------------------------------------------------
    
    
    FILE: ...tudenttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/key/src/Form/KeyEditForm.php
    ---------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------
     13 | WARNING | The class short comment should describe what the class does and not simply repeat
        |         | the class name
    ---------------------------------------------------------------------------------------------------
    
    
    FILE: ...studenttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/key/src/Form/KeyAddForm.php
    ---------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------
     11 | WARNING | The class short comment should describe what the class does and not simply repeat
        |         | the class name
    ---------------------------------------------------------------------------------------------------
    
    
    FILE: ...s/Drupal.org/drupalorg-site/docroot/modules/contrib/key/src/Form/KeyConfigOverrideAddForm.php
    ---------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------
      18 | WARNING | The class short comment should describe what the class does and not simply repeat
         |         | the class name
     300 | ERROR   | The array declaration extends to column 111 (the limit is 80). The array content
         |         | should be split up over multiple lines
    ---------------------------------------------------------------------------------------------------
    
    
    FILE: ...denttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/key/src/KeyConfigOverrides.php
    ---------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
    ---------------------------------------------------------------------------------------------------
      54 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
      55 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
      73 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     144 | WARNING | Unused variable $id.
    ---------------------------------------------------------------------------------------------------
    
    
    FILE: ...nttrainees/Drupal.org/drupalorg-site/docroot/modules/contrib/key/src/Commands/KeyCommands.php
    ---------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------
      17 | WARNING | The class short comment should describe what the class does and not simply repeat
         |         | the class name
     234 | ERROR   | The array declaration extends to column 87 (the limit is 80). The array content
         |         | should be split up over multiple lines
    ---------------------------------------------------------------------------------------------------
    
    Time: 1.6 secs; Memory: 14MB

    Please check.Thank You.

  • Assigned to nitin_lama
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    7 pass, 1 fail
  • 🇮🇳India nitin_lama India

    Addressed #5.
    Updated patch.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India nitin_lama India

    Please review. Thanks

  • Assigned to nitin_lama
  • Status changed to Needs work over 1 year ago
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    8 pass
  • 🇮🇳India nitin_lama India

    Only issue remaining:

    FILE: /home/system/Documents/contribution/key/tests/src/Unit/Entity/KeyEntityTest.php
    --------------------------------------------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    --------------------------------------------------------------------------------------------------------------------------------------
      44 | ERROR | Class property $key_type_settings should use lowerCamel naming without underscores
      52 | ERROR | Class property $key_provider_settings should use lowerCamel naming without underscores
      60 | ERROR | Class property $key_input_settings should use lowerCamel naming without underscores
     111 | ERROR | The array declaration extends to column 99 (the limit is 80). The array content should be split up over multiple lines
    --------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 346ms; Memory: 10MB
    

    Updated patch. Please review. Thanks.

  • 🇯🇵Japan ptmkenny

    We need to consolidate the work in this issue and 📌 Fix the issues reported by phpcs Needs review .

  • 🇵🇹Portugal jcnventura

    Since this issue doesn't have an MR, I'd suggest to merge 📌 Fix the issues reported by phpcs Needs review and then check if there's still anything still outstanding that is fixed in this issue. A cursory look at the contents of both suggests that the fixes here are a subset of the ones in the other issue.

  • Status changed to Closed: duplicate 6 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
Production build 0.71.5 2024