Fix the issues reported by phpcs

Created on 11 January 2020, almost 5 years ago
Updated 15 August 2024, 3 months ago

PHP_CodeSniffer reports the following errors/warnings that should be fixed, when they are not false positive.

FILE: /Users/specbee/Sites/Projects/entity_vistiors/entity_visitors.page.inc
----------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------
 24 | WARNING | Unused variable $entity_visitors.
----------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/entity_vistiors/entity_visitors.info.yml
-----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------
 1 | WARNING | "core_version_requirement" property is missing in the info.yml file
-----------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/entity_vistiors/src/Form/EntityVisitorsSettingsForm.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
 12 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
-----------------------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/entity_vistiors/src/Form/EntityVisitiorsConfig.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------
  11 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
  57 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 114 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/entity_vistiors/src/Form/EntityVisitorsForm.php
-----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------
 37 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
-----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/entity_vistiors/src/EntityVisitorsListBuilder.php
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------
 37 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/entity_vistiors/src/Service/EntityVisitorsManager.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------
  16 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
 133 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 144 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/entity_vistiors/src/EventSubscriber/SendMailOnEntityVisitedSubscriber.php
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
 52 | WARNING | User::load calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/entity_vistiors/src/EventSubscriber/EntityRouteMatchSubscriber.php
------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------
 64 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------

Time: 263ms; Memory: 10MB

Steps to reproduce

Run phpcs --standard=โ€œDrupal,DrupalPracticeโ€ --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js.

๐Ÿ“Œ Task
Status

Needs work

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia rksyravi New Delhi, ๐Ÿ‡ฎ๐Ÿ‡ณ

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

Not all content is available!

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

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia surya pratap

    surya pratap โ†’ made their first commit to this issueโ€™s fork.

  • Assigned to surya pratap
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia surya pratap

    FILE: /var/www/html/contribution/web/modules/contrib/entity_vistiors-3105864/entity_visitors.page.inc
    -----------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------
    24 | WARNING | Unused variable $entity_visitors.
    -----------------------------------------------------------------------------------------------------

    FILE: /var/www/html/contribution/web/modules/contrib/entity_vistiors-3105864/entity_visitors.info.yml
    -----------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------
    1 | WARNING | "core_version_requirement" property is missing in the info.yml file
    -----------------------------------------------------------------------------------------------------

    FILE: /var/www/html/contribution/web/modules/contrib/entity_vistiors-3105864/src/Form/EntityVisitorsSettingsForm.php
    --------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------
    12 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    --------------------------------------------------------------------------------------------------------------------

    FILE: /var/www/html/contribution/web/modules/contrib/entity_vistiors-3105864/src/Form/EntityVisitiorsConfig.php
    ------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ------------------------------------------------------------------------------------------------------------------
    11 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    57 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    114 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ------------------------------------------------------------------------------------------------------------------

    FILE: /var/www/html/contribution/web/modules/contrib/entity_vistiors-3105864/src/EventSubscriber/EntityRouteMatchSubscriber.php
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
    64 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------------------------------

    FILE: /var/www/html/contribution/web/modules/contrib/entity_vistiors-3105864/src/EventSubscriber/SendMailOnEntityVisitedSubscriber.php
    --------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------------------
    52 | WARNING | User::load calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------------------------------------------------------------

    FILE: /var/www/html/contribution/web/modules/contrib/entity_vistiors-3105864/src/Service/EntityVisitorsManager.php
    ------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ------------------------------------------------------------------------------------------------------------------
    16 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    133 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    144 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead

  • Merge request !1phpcs issues fixed โ†’ (Open) created by surya pratap
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    The issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, show which command and arguments have been used, and which report that command shown.

    https://pareview.sh/pareview/https-git.drupal.org-project-entity_vistior... is not accessible and it is not possible to get what warnings/errors must be fixed.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad

    Issue summary updated.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    zniki.ru โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru
  • Status changed to Needs work 3 months ago
  • Hi @Nikolay Shapovalov,

    Applied the changes you made on MR!1 to the 8.x-1.x branch of this module, it was applied smoothly, however, multiple errors were still reported. Please see below:

    โžœ  entity_vistiors git:(8.x-1.x) curl https://git.drupalcode.org/project/entity_vistiors/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 12193    0 12193    0     0  29408      0 --:--:-- --:--:-- --:--:-- 30106
    patching file entity_visitors.info.yml
    patching file entity_visitors.page.inc
    patching file src/EntityVisitorsListBuilder.php
    patching file src/EventSubscriber/EntityRouteMatchSubscriber.php
    patching file src/EventSubscriber/SendMailOnEntityVisitedSubscriber.php
    patching file src/Form/EntityVisitiorsConfig.php
    patching file src/Form/EntityVisitorsForm.php
    patching file src/Form/EntityVisitorsSettingsForm.php
    patching file src/Service/EntityVisitorsManager.php
    โžœ  entity_vistiors git:(8.x-1.x) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig entity_vistiors
    
    
    FILE: ...modules/contrib/entity_vistiors/src/EntityVisitorsAccessControlHandler.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Access\AccessResult.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...issue-v9/web/modules/contrib/entity_vistiors/src/Entity/EntityVisitors.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first
       |       |     wrong one is Drupal\Core\Entity\ContentEntityBase.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../web/modules/contrib/entity_vistiors/src/Service/EntityVisitorsManager.php
    --------------------------------------------------------------------------------
    FOUND 10 ERRORS AFFECTING 9 LINES
    --------------------------------------------------------------------------------
     12 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Drupal\Core\Config\ConfigManagerInterface.
     73 | ERROR | [x] Multi-line function declaration not indented correctly;
        |       |     expected 4 spaces but found 8
     74 | ERROR | [x] Multi-line function declaration not indented correctly;
        |       |     expected 4 spaces but found 8
     75 | ERROR | [x] Multi-line function declaration not indented correctly;
        |       |     expected 4 spaces but found 8
     76 | ERROR | [x] Multi-line function declaration not indented correctly;
        |       |     expected 4 spaces but found 8
     77 | ERROR | [x] Multi-line function declaration not indented correctly;
        |       |     expected 4 spaces but found 8
     78 | ERROR | [x] Multi-line function declaration not indented correctly;
        |       |     expected 4 spaces but found 8
     79 | ERROR | [x] Multi-line function declaration not indented correctly;
        |       |     expected 4 spaces but found 8
     79 | ERROR | [x] Multi-line function declarations must have a trailing comma
        |       |     after the last parameter
     80 | ERROR | [x] Multi-line function declaration not indented correctly;
        |       |     expected 2 spaces but found 4
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: .../entity_vistiors/src/EventSubscriber/SendMailOnEntityVisitedSubscriber.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     9 | 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: ...contrib/entity_vistiors/src/EventSubscriber/EntityRouteMatchSubscriber.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     11 | ERROR | [x] Use statements should be sorted alphabetically. The first
        |       |     wrong one is Drupal\Component\Datetime\TimeInterface.
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 357ms; Memory: 10MB

    Kindly check

    Thanks,
    Jake

  • Pipeline finished with Success
    3 months ago
    Total: 149s
    #255083
Production build 0.71.5 2024