Bug Drupal Coding Standard

Created on 29 May 2022, over 2 years ago
Updated 16 January 2023, over 1 year ago

Hi @chfoidl
I ran Check Drupal coding standards and I use Drupal Check code, you can review and fix it.

1.Run Drupal Check

$ drupal-check web/modules/contrib/emitter
 -- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     Error
 -- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     Child process error (exit code 255): PHP Parse error:  syntax error, unexpected '?', expecting function (T_FUNCTION) or const (T_CONST) in
     C:\Ampps\www\Test-Drupal-Buiding\web\modules\contrib\emitter\src\Emitter.php on line 19
     Parse error: syntax error, unexpected '?', expecting function (T_FUNCTION) or const (T_CONST) in C:\Ampps\www\Test-Drupal-Buiding\web\modules\contrib\emitter\src\Emitter.php on
     line 19
     PHP Fatal error:  Declaration of Drupal\emitter\ProxyClass\Emitter::setMasterKey(string $masterKey): Drupal\emitter\Emitter must be compatible with
     Drupal\emitter\EmitterInterface::setMasterKey(string $masterKey): Drupal\emitter\EmitterInterface in
     C:\Ampps\www\Test-Drupal-Buiding\web\modules\contrib\emitter\src\ProxyClass\Emitter.php on line 15
     Fatal error: Declaration of Drupal\emitter\ProxyClass\Emitter::setMasterKey(string $masterKey): Drupal\emitter\Emitter must be compatible with
     Drupal\emitter\EmitterInterface::setMasterKey(string $masterKey): Drupal\emitter\EmitterInterface in
     C:\Ampps\www\Test-Drupal-Buiding\web\modules\contrib\emitter\src\ProxyClass\Emitter.php on line 15

 -- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

2. Run Drupal Coding Standard

$ phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/contrib/emitter

FILE: C:\Ampps\www\Test-Drupal-Buiding\web\modules\contrib\emitter\emitter.info.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: C:\Ampps\www\Test-Drupal-Buiding\web\modules\contrib\emitter\modules\emitter_userchannel\src\Controller\UserChannelKeyController.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 20 | ERROR | [x] Data types in @param tags need to be fully namespaced
 39 | ERROR | [x] Data types in @return tags need to be fully namespaced
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\Ampps\www\Test-Drupal-Buiding\web\modules\contrib\emitter\modules\emitter_userchannel\src\UserKeygen.php
-----------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
-----------------------------------------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 19 | ERROR | [x] Data types in @param tags need to be fully namespaced
 21 | ERROR | [x] Data types in @param tags need to be fully namespaced
 37 | ERROR | [x] Data types in @param tags need to be fully namespaced
 63 | ERROR | [x] Data types in @param tags need to be fully namespaced
 82 | ERROR | [x] Data types in @param tags need to be fully namespaced
-----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------


FILE: C:\Ampps\www\Test-Drupal-Buiding\web\modules\contrib\emitter\src\Emitter.php
-----------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 18 | ERROR | [ ] Missing @var tag in member variable comment
-----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------


Time: 258ms; Memory: 8MB

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇻🇳Vietnam LuongGiap

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.

Production build 0.71.5 2024