Fix the issues reported by phpcs

Created on 8 July 2024, 4 months ago
Updated 29 August 2024, about 2 months ago

Problem/Motivation

Running :-
vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/domain_entity_type/
returns the following warnings/errors, which should be fixed.

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/domain_entity_type/src/Services/DomainEntityTypeManager.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
35 | ERROR | [x] Case breaking statements must be followed by a single blank line
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/domain_entity_type/modules/det_node/src/Access/NodeTypeDomainAccessCheck.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
43 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/domain_entity_type/modules/det_node/src/NodeTypeListBuilderOverride.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
19 | ERROR | [x] Data types in @var tags need to be fully namespaced
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/domain_entity_type/modules/det_node/src/Controller/NodeControllerOverride.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
43 | ERROR | [x] Data types in @var tags need to be fully namespaced
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/domain_entity_type/modules/det_node/src/NodeTypeAccessOverride.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------
23 | ERROR | [x] Data types in @var tags need to be fully namespaced
35 | ERROR | [ ] Doc comment short description must start with a capital letter
35 | ERROR | [ ] Doc comment short description must end with a full stop
-------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------

FILE: /home/prem/Documents/drupal-10.3.1/web/modules/contrib/domain_entity_type/modules/det_node/det_node.module
----------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Doc comment short description must end with a full stop
22 | ERROR | [x] Data types in @var tags need to be fully namespaced
----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------

Time: 144ms; Memory: 10MB

📌 Task
Status

Needs work

Version

1.0

Component

Code

Created by

🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

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 @prem suthar
  • Assigned to kalash-j
  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
  • 🇮🇳India kalash-j jaipur

    I have solved the PHPCS errors.

  • Status changed to Needs work 4 months ago
  • Hi kalash-j,

    Applied your changes on the MR !2, it applied successfully, however, there was still one error reported.

    domain_entity_type git:(main) curl https://git.drupalcode.org/project/domain_entity_type/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 11136    0 11136    0     0  22993      0 --:--:-- --:--:-- --:--:-- 23643
    patching file domain_entity_type.info.yml
    patching file domain_entity_type.install
    patching file modules/det_node/det_node.module
    patching file modules/det_node/det_node.services.yml
    patching file modules/det_node/src/Access/NodeTypeDomainAccessCheck.php
    patching file modules/det_node/src/Controller/NodeControllerOverride.php
    patching file modules/det_node/src/NodeTypeAccessOverride.php
    patching file modules/det_node/src/NodeTypeListBuilderOverride.php
    patching file modules/det_node/src/Routing/NodeRouteSubscriber.php
    patching file src/Services/DomainEntityTypeManager.php
    ➜  domain_entity_type git:(main) ✗ cd ..
    ➜  contrib git:(master) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig domain_entity_type
    
    FILE: ...main_entity_type/modules/det_node/src/Access/NodeTypeDomainAccessCheck.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     55 | ERROR | [x] Multi-line function declarations must have a trailing comma
        |       |     after the last parameter
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 406ms; Memory: 10MB

    Kindly check

    Thanks,
    Jake

  • 🇮🇳India dev2.addweb

    nilesh.addweb made their first commit to this issue’s fork.

  • Status changed to Needs review 3 months ago
  • 🇮🇳India dev2.addweb

    Hi,
    I have fixed remaining phpcs issues, please review it.

  • Status changed to RTBC 3 months ago
  • 🇮🇳India riddhi.addweb

    The mentioned phpcs issue is resolved, & I have also checked and it is working as expected. I am attaching the Screenshots & doing RTBC for the same.

  • Status changed to Needs work about 2 months ago
  • 🇮🇳India Tirupati_Singh

    Hi, I've applied the provided MR as a patch and it applied cleanly with no errors. After applying the patch, the mentioned phpcs issue have been resolved successfully. However getting errors shown in the attached screenshot while clearing the cache command: drush cr. I've attached the screenshot for reference. As the new issue was encountered after applying the patch hence, moving the issue status to Needs work.

  • 🇲🇦Morocco akram zairig Rabat, Morocco

    Hi @tirupati_singh ,

    I'll work on a patch to solve those errors.

  • 🇲🇦Morocco b.khouy 🇲🇦 Morocco

    I've integrated PHPCS, PHPStan, and the necessary linters into the project's GitLab CI to ensure clean and consistent code for all future contributions. The fixes have been merged into the 1.0.x branch.

    To apply these fixes in your projects before the next official release, you can run the following command:
    composer require 'drupal/domain_entity_type:1.0.x-dev@dev'

    Thank you, everyone!

  • 🇲🇦Morocco b.khouy 🇲🇦 Morocco
  • 🇲🇦Morocco b.khouy 🇲🇦 Morocco
  • 🇮🇳India kalash-j jaipur

    kalash-j changed the visibility of the branch 3459966-fix-the-issues to active.

  • 🇮🇳India kalash-j jaipur

    kalash-j changed the visibility of the branch 3459966-fix-the-issues to hidden.

Production build 0.71.5 2024