Hey, I came across some best practices issues and coding standards, example of Drupal practices :

phpcs --standard=Drupal modules/contrib/jsonapi_extras/

FILE: /var/www/drupal-8/modules/contrib/jsonapi_extras/modules/jsonapi_defaults/README.txt
------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
------------------------------------------------------------------------------------------
  5 | WARNING | Line exceeds 80 characters; contains 344 characters
  9 | WARNING | Line exceeds 80 characters; contains 96 characters
 10 | WARNING | Line exceeds 80 characters; contains 93 characters
 11 | WARNING | Line exceeds 80 characters; contains 94 characters
 12 | WARNING | Line exceeds 80 characters; contains 91 characters
------------------------------------------------------------------------------------------


FILE: /var/www/drupal-8/modules/contrib/jsonapi_extras/modules/jsonapi_defaults/tests/src/Functional/JsonApiDefaultsFunctionalTest.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
 16 | ERROR | Missing member variable doc comment
--------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/drupal-8/modules/contrib/jsonapi_extras/tests/src/Functional/JsonApiExtrasFunctionalTest.php
-----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
 25 | ERROR | Missing member variable doc comment
-----------------------------------------------------------------------------------------------------------


FILE: /var/www/drupal-8/modules/contrib/jsonapi_extras/src/Form/JsonapiExtrasSettingsForm.php
---------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
 16 | ERROR | Missing member variable doc comment
---------------------------------------------------------------------------------------------


FILE: /var/www/drupal-8/modules/contrib/jsonapi_extras/src/Plugin/jsonapi/FieldEnhancer/JSONFieldEnhancer.php
-------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 2 WARNINGS AFFECTING 9 LINES
-------------------------------------------------------------------------------------------------------------
  9 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
 23 | ERROR   | [ ] Missing short description in doc comment
 28 | ERROR   | [ ] Missing short description in doc comment
 30 | ERROR   | [ ] Missing parameter comment
 31 | ERROR   | [ ] Missing parameter comment
 32 | ERROR   | [ ] Missing parameter comment
 32 | ERROR   | [ ] Missing parameter type
 33 | ERROR   | [ ] Missing parameter comment
 76 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 77 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
-------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------


FILE: /var/www/drupal-8/modules/contrib/jsonapi_extras/src/Plugin/ResourceFieldEnhancerInterface.php
----------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------
 5 | WARNING | [x] Unused use statement
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------


FILE: /var/www/drupal-8/modules/contrib/jsonapi_extras/css/jsonapi_extras.expandable_rows_table.css
---------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 10 LINES
---------------------------------------------------------------------------------------------------
  2 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
  3 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
  7 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 11 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 12 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 16 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 20 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 24 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 28 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 32 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------


FILE: /var/www/drupal-8/modules/contrib/jsonapi_extras/jsonapi_extras.module
----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------
 52 | ERROR | Type hint "array" missing for $variables
----------------------------------------------------------------------------

Time: 1.69 secs; Memory: 14MB
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sergiu Stici created an issue. See original summary.

Sergiu Stici’s picture

Status: Active » Needs review
FileSize
7.02 KB

Here is the patch, please review.

e0ipso’s picture

Status: Needs review » Fixed

Thanks for taking care of this! 🙏🏽

  • e0ipso committed 5b5511a on 8.x-3.x authored by Sergiu Stici
    Issue #3065906 by Sergiu Stici: Drupal best practices and coding...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.