Fix the errors/warnings reported by PHP_CodeSniffer

Created on 8 March 2024, 9 months ago
Updated 19 July 2024, 4 months ago

Problem/Motivation

When running the module code against Drupal coding standards based on Drupal standard, the module shows errors

Steps to reproduce

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

Report:

FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/opigno_poll.links.action.yml
---------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
 5 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------

FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/opigno_poll.install
------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------
 67 | ERROR   | [x] Expected 1 blank line after function; 2 found
 84 | WARNING | [x] There must be no blank line following an inline comment
 84 | WARNING | [ ] There must be no blank line following an inline comment
 93 | ERROR   | [ ] Empty installation hooks are not necessary
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/src/Plugin/views/field/PollStatus.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
 35 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/src/Plugin/Field/FieldWidget/PollChoiceDefaultWidget.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
  61 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 101 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/src/Plugin/Block/ChartBlock.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 7 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 30 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 32 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 36 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 40 | WARNING | Unused variable $key.
 63 | 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
 79 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/src/Plugin/migrate/destination/PollVote.php
----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------
  7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\migrate\Plugin\migrate\destination\DestinationBase.
 26 | ERROR | [ ] Class property $PollVoteStorage should use lowerCamel naming without underscores
 42 | ERROR | [ ] Variable "PollVoteStorage" starts with a capital letter, but only $lowerCamelCase or $snake_case is allowed
 44 | ERROR | [ ] Variable "PollVoteStorage" starts with a capital letter, but only $lowerCamelCase or $snake_case is allowed
----------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/src/PollVoteStorage.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 8 WARNINGS AFFECTING 8 LINES
------------------------------------------------------------------------------------------------------------------------------------------
  84 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  85 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 136 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 155 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 178 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 189 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 195 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 208 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/src/PollListBuilder.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 10 WARNINGS AFFECTING 9 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 39 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 40 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 41 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 42 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 43 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 44 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 55 | WARNING | Unused variable $vote_storage.
 63 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 63 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 65 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/src/Form/PollSettingsForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
 33 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/src/Form/PollDeleteForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
 18 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/src/Form/PollViewForm.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
------------------------------------------------------------------------------------------------------------------------------------------
  73 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  86 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  93 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 124 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 189 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 198 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 208 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 218 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 240 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 242 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 296 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 297 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 302 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 354 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/src/Form/PollForm.php
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
 66 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/src/PollPostRenderCache.php
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------
 63 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 65 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 65 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/opigno_poll.links.menu.yml
-------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------
 11 | ERROR | [x] Expected 1 newline at end of file; 2 found
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------


FILE: /home/contribution/drupal/web/modules/contrib/opigno_poll/opigno_poll.module
------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 6 WARNINGS AFFECTING 9 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------
  15 | WARNING | [ ] All constants defined by a module must be prefixed with the module's name, expected "OPIGNO_POLL_opigno_poll_NOT_PUBLISHED" but found
     |         |     "opigno_poll_NOT_PUBLISHED"
  15 | WARNING | [ ] Global constants should not be used, move it to a class or interface
  15 | ERROR   | [ ] Class constants must be uppercase; expected OPIGNO_POLL_NOT_PUBLISHED but found opigno_poll_NOT_PUBLISHED
  20 | WARNING | [ ] All constants defined by a module must be prefixed with the module's name, expected "OPIGNO_POLL_opigno_poll_PUBLISHED" but found
     |         |     "opigno_poll_PUBLISHED"
  20 | WARNING | [ ] Global constants should not be used, move it to a class or interface
  20 | ERROR   | [ ] Class constants must be uppercase; expected OPIGNO_POLL_PUBLISHED but found opigno_poll_PUBLISHED
  33 | ERROR   | [ ] The array declaration extends to column 570 (the limit is 120). The array content should be split up over multiple lines
  35 | ERROR   | [ ] The array declaration extends to column 493 (the limit is 120). The array content should be split up over multiple lines
 152 | WARNING | [ ] Unused variable $opigno_poll.
 206 | WARNING | [ ] Unused variable $userId.
 230 | ERROR   | [ ] Doc comment is empty
 233 | ERROR   | [ ] Invalid function name, expected validate_lp_member but found validateLPMember
 233 | ERROR   | [ ] All functions defined in a module file must be prefixed with the module's name, found "validateLPMember" but expected
     |         |     "opigno_poll_validateLPMember"
 238 | ERROR   | [x] Expected 1 newline at end of file; 2 found
------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------

๐Ÿ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia realsp

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

  • Issue created by @realsp
  • First commit to issue fork.
  • Merge request !4Fixed the phpcs errors. โ†’ (Open) created by uttam
  • Status changed to Needs review 8 months ago
  • Status changed to Needs work 8 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi

    I applied and tested MR !4 and I can still see many PHPCS issues

    โžœ  opigno_poll git:(master) โœ— curl https://git.drupalcode.org/project/opigno_poll/-/merge_requests/4.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 22491    0 22491    0     0  38902      0 --:--:-- --:--:-- --:--:-- 39736
    patching file opigno_poll.install
    patching file opigno_poll.links.action.yml
    patching file opigno_poll.links.menu.yml
    patching file opigno_poll.module
    patching file 'src/Form/PollDeleteForm.php'
    patching file 'src/Form/PollForm.php'
    patching file 'src/Form/PollViewForm.php'
    patching file 'src/Plugin/Field/FieldWidget/PollChoiceDefaultWidget.php'
    patching file 'src/Plugin/migrate/destination/PollVote.php'
    patching file 'src/Plugin/views/field/PollStatus.php'
    patching file 'src/PollListBuilder.php'
    patching file 'src/PollPostRenderCache.php'
    โžœ  opigno_poll git:(master) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml opigno_poll 
    
    FILE: ...s/d9/d9-local/web/modules/contrib/opigno_poll/opigno_poll.links.action.yml
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Expected 1 newline at end of file; 0 found
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../Projects/d9/d9-local/web/modules/contrib/opigno_poll/opigno_poll.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: ...ng/Projects/d9/d9-local/web/modules/contrib/opigno_poll/opigno_poll.module
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
    --------------------------------------------------------------------------------
      15 | WARNING | Global constants should not be used, move it to a class or
         |         | interface
      20 | WARNING | Global constants should not be used, move it to a class or
         |         | interface
     236 | ERROR   | Doc comment is empty
    --------------------------------------------------------------------------------
    
    
    FILE: ...bing-subing/Projects/d9/d9-local/web/modules/contrib/opigno_poll/README.md
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     4 | WARNING | Line exceeds 80 characters; contains 195 characters
    --------------------------------------------------------------------------------
    
    
    FILE: ...Projects/d9/d9-local/web/modules/contrib/opigno_poll/src/Form/PollForm.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     96 | ERROR | The array declaration extends to column 95 (the limit is 80). The
        |       | array content should be split up over multiple lines
    --------------------------------------------------------------------------------
    
    
    FILE: ...ects/d9/d9-local/web/modules/contrib/opigno_poll/src/Form/PollViewForm.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 9 WARNINGS AFFECTING 10 LINES
    --------------------------------------------------------------------------------
      75 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
      95 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     126 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     182 | ERROR   | The array declaration extends to column 117 (the limit is 80).
         |         | The array content should be split up over multiple lines
     182 | ERROR   | The array declaration extends to column 116 (the limit is 80).
         |         | The array content should be split up over multiple lines
     242 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     244 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     298 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     299 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     304 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     356 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
    --------------------------------------------------------------------------------
    
    
    FILE: .../d9/d9-local/web/modules/contrib/opigno_poll/src/Form/PollSettingsForm.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     33 | WARNING | t() calls should be avoided in classes, use
        |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
        |         | $this->t() instead
    --------------------------------------------------------------------------------
    
    
    FILE: .../d9-local/web/modules/contrib/opigno_poll/src/PollAccessControlHandler.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     23 | ERROR | The array declaration extends to column 109 (the limit is 80).
        |       | The array content should be split up over multiple lines
     46 | ERROR | The array declaration extends to column 113 (the limit is 80).
        |       | The array content should be split up over multiple lines
    --------------------------------------------------------------------------------
    
    
    FILE: ...g/Projects/d9/d9-local/web/modules/contrib/opigno_poll/src/Entity/Poll.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     290 | ERROR | The array declaration extends to column 102 (the limit is 80).
         |       | The array content should be split up over multiple lines
    --------------------------------------------------------------------------------
    
    
    FILE: ...ntrib/opigno_poll/src/Plugin/Field/FieldWidget/PollChoiceDefaultWidget.php
    --------------------------------------------------------------------------------
    FOUND 6 ERRORS AND 1 WARNING AFFECTING 7 LINES
    --------------------------------------------------------------------------------
      10 | ERROR   | [x] Use statements should be sorted alphabetically. The first
         |         |     wrong one is
         |         |     Drupal\Core\Entity\EntityTypeManagerInterface.
      38 | ERROR   | [ ] Doc comment for parameter $plugin_id does not match actual
         |         |     variable name $entity_type_manager
      40 | ERROR   | [ ] Doc comment for parameter $plugin_definition does not
         |         |     match actual variable name $entity_type_manager
      42 | ERROR   | [ ] Superfluous parameter comment
      44 | ERROR   | [ ] Superfluous parameter comment
      49 | ERROR   | [x] Expected 1 blank line after function; 2 found
     138 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
         |         |     injection instead
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...9/d9-local/web/modules/contrib/opigno_poll/src/Plugin/Block/ChartBlock.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 7 LINES
    --------------------------------------------------------------------------------
     30 | WARNING | \Drupal calls should be avoided in classes, use dependency
        |         | injection instead
     32 | WARNING | \Drupal calls should be avoided in classes, use dependency
        |         | injection instead
     36 | WARNING | \Drupal calls should be avoided in classes, use dependency
        |         | injection instead
     40 | WARNING | Unused variable $key.
     63 | 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
     79 | WARNING | t() calls should be avoided in classes, use
        |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
        |         | $this->t() instead
    --------------------------------------------------------------------------------
    
    
    FILE: ...ojects/d9/d9-local/web/modules/contrib/opigno_poll/src/PollVoteStorage.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 8 WARNINGS AFFECTING 8 LINES
    --------------------------------------------------------------------------------
      84 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
      85 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     136 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     155 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     178 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     189 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
     195 | WARNING | t() calls should be avoided in classes, use
         |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
         |         | $this->t() instead
     208 | WARNING | \Drupal calls should be avoided in classes, use dependency
         |         | injection instead
    --------------------------------------------------------------------------------
    
    Time: 906ms; Memory: 12MB
    
    โžœ  contrib git:(master) โœ— 
    
  • gaurav gupta Jaipur, Rajasthsan

    Gaurav Gupta โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 7 months ago
  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    I applied MR !4 and I can still see these PHPCS errors

      opigno_poll git:(master) โœ— curl https://git.drupalcode.org/project/opigno_poll/-/merge_requests/4.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 51667    0 51667    0     0  59528      0 --:--:-- --:--:-- --:--:-- 60008
    patching file opigno_poll.install
    patching file opigno_poll.links.action.yml
    patching file opigno_poll.links.menu.yml
    patching file opigno_poll.module
    patching file 'src/Entity/Poll.php'
    patching file 'src/Form/PollDeleteForm.php'
    patching file 'src/Form/PollForm.php'
    patching file 'src/Form/PollSettingsForm.php'
    patching file 'src/Form/PollViewForm.php'
    patching file 'src/Plugin/Block/ChartBlock.php'
    patching file 'src/Plugin/Block/PollRecentBlock.php'
    patching file 'src/Plugin/Field/FieldWidget/PollChoiceDefaultWidget.php'
    patching file 'src/Plugin/migrate/destination/PollVote.php'
    patching file 'src/Plugin/views/field/PollStatus.php'
    patching file 'src/PollAccessControlHandler.php'
    patching file 'src/PollInterface.php'
    patching file 'src/PollListBuilder.php'
    patching file 'src/PollPostRenderCache.php'
    patching file 'src/PollVoteStorage.php'
    โžœ  opigno_poll git:(master) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml opigno_poll    
    
    FILE: ...s/d9/d9-local/web/modules/contrib/opigno_poll/opigno_poll.links.action.yml
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Expected 1 newline at end of file; 0 found
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../Projects/d9/d9-local/web/modules/contrib/opigno_poll/opigno_poll.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: ...ng/Projects/d9/d9-local/web/modules/contrib/opigno_poll/opigno_poll.module
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     11 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Drupal\opigno_poll\PollInterface.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...bing-subing/Projects/d9/d9-local/web/modules/contrib/opigno_poll/README.md
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     4 | WARNING | Line exceeds 80 characters; contains 195 characters
    --------------------------------------------------------------------------------
    
    
    FILE: ...ects/d9/d9-local/web/modules/contrib/opigno_poll/src/Form/PollViewForm.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     14 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Drupal\Core\Render\RendererInterface.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...ntrib/opigno_poll/src/Plugin/Field/FieldWidget/PollChoiceDefaultWidget.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Drupal\Core\Entity\EntityTypeManagerInterface.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...9/d9-local/web/modules/contrib/opigno_poll/src/Plugin/Block/ChartBlock.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Drupal\opigno_poll\PollVoteStorageInterface.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...ts/d9/d9-local/web/modules/contrib/opigno_poll/src/PollPostRenderCache.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\DependencyInjection\ClassResolver.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...ojects/d9/d9-local/web/modules/contrib/opigno_poll/src/PollVoteStorage.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Entity\EntityTypeManagerInterface.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 829ms; Memory: 12MB
    
    โžœ  contrib git:(master) โœ— 
    
  • Hi,
    Applied MR!4 and ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,yml opigno_poll/, found no phpcs issues.

  • Status changed to Needs review 6 months ago
  • gaurav gupta Jaipur, Rajasthsan

    I have confirmed MR applies successfully and no PHPCS issues are pending.

  • Issue was unassigned.
  • Status changed to Needs work 4 months ago
  • Hello @Gaurav Gupta,
    After applying the patch I'm getting quite a few errors even now, Which are:

    FILE: ...no_poll/src/Plugin/Field/FieldWidget/PollChoiceDefaultWidget.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The
        |       |     first wrong one is
        |       |     Drupal\Core\Entity\EntityTypeManagerInterface.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: .../web/modules/contrib/opigno_poll/src/Plugin/Block/ChartBlock.php
    ----------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ----------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The
        |       |     first wrong one is
        |       |     Drupal\opigno_poll\PollVoteStorageInterface.
     81 | ERROR | [x] Multi-line function declarations must have a
        |       |     trailing comma after the last parameter
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /app/web/modules/contrib/opigno_poll/src/PollPostRenderCache.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The
       |       |     first wrong one is
       |       |     Drupal\Core\DependencyInjection\ClassResolver.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /app/web/modules/contrib/opigno_poll/src/Form/PollViewForm.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     14 | ERROR | [x] Use statements should be sorted alphabetically. The
        |       |     first wrong one is
        |       |     Drupal\Core\Render\RendererInterface.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /app/web/modules/contrib/opigno_poll/src/PollVoteStorage.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The
       |       |     first wrong one is
       |       |     Drupal\Core\Entity\EntityTypeManagerInterface.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /app/web/modules/contrib/opigno_poll/PATCHES.txt
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     5 | ERROR | [x] Expected 1 newline at end of file; 3 found
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: ...app/web/modules/contrib/opigno_poll/opigno_poll.links.action.yml
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     6 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /app/web/modules/contrib/opigno_poll/opigno_poll.module
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     11 | ERROR | [x] Use statements should be sorted alphabetically. The
        |       |     first wrong one is
        |       |     Drupal\opigno_poll\PollInterface.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    Time: 656ms; Memory: 14MB
    

    I've also noticed that several Phpcs issues are also there for the latest version 1.0.1 as well, so I think it'll be better if we solve the issue on the latest version of this, hence updating the version component from 1.0.0 to 1.0.1
    The Phpcs errors/warnings what I'm getting on the latest version after applying your patch are as follows:

    FILE: ...no_poll/src/Plugin/Field/FieldWidget/PollChoiceDefaultWidget.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The
        |       |     first wrong one is
        |       |     Drupal\Core\Entity\EntityTypeManagerInterface.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: .../web/modules/contrib/opigno_poll/src/Plugin/Block/ChartBlock.php
    ----------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ----------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The
        |       |     first wrong one is
        |       |     Drupal\opigno_poll\PollVoteStorageInterface.
     81 | ERROR | [x] Multi-line function declarations must have a
        |       |     trailing comma after the last parameter
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /app/web/modules/contrib/opigno_poll/src/PollPostRenderCache.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The
       |       |     first wrong one is
       |       |     Drupal\Core\DependencyInjection\ClassResolver.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /app/web/modules/contrib/opigno_poll/src/Form/PollViewForm.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     14 | ERROR | [x] Use statements should be sorted alphabetically. The
        |       |     first wrong one is
        |       |     Drupal\Core\Render\RendererInterface.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /app/web/modules/contrib/opigno_poll/src/PollVoteStorage.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The
       |       |     first wrong one is
       |       |     Drupal\Core\Entity\EntityTypeManagerInterface.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /app/web/modules/contrib/opigno_poll/PATCHES.txt
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     5 | ERROR | [x] Expected 1 newline at end of file; 3 found
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: ...app/web/modules/contrib/opigno_poll/opigno_poll.links.action.yml
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     6 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    
    FILE: /app/web/modules/contrib/opigno_poll/opigno_poll.module
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     11 | ERROR | [x] Use statements should be sorted alphabetically. The
        |       |     first wrong one is
        |       |     Drupal\opigno_poll\PollInterface.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
    Time: 741ms; Memory: 14MB
    
  • Assigned to hetal.solanki
  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia hetal.solanki

    @realsp, @sourojeetpaul

    Applied MR!4 and Fixed the remaining PHPCS issue.

    Thank you!!

  • Status changed to Needs work 4 months ago
  • Just a single Phpcs error is remaining to be fixed!

    FILE: .../web/modules/contrib/opigno_poll/src/Plugin/Block/ChartBlock.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
     81 | ERROR | [x] Multi-line function declarations must have a
        |       |     trailing comma after the last parameter
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    
  • Status changed to Needs review 4 months ago
  • gaurav gupta Jaipur, Rajasthsan

    Hello ,
    i have solved the remaining issues.
    Please check .
    Thanks.

  • Status changed to RTBC 4 months ago
  • Hello @Gaurav,
    I can confirm that the latest commit resolves the last one remaining Phpcs error and now there're no Phpcs issues remaining which are to be addressed, hence moving the issue to RTBC++

Production build 0.71.5 2024