Fix Drupal Coding Standard Errors

Created on 7 September 2020, almost 4 years ago
Updated 8 June 2024, 21 days ago

Problem/Motivation

phpcs --standard=DrupalPractice,Drupal .

FILE: /regex_redirect/src/Entity/RegexRedirect.php
-------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------
 178 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
 192 | ERROR | [x] Expected 1 blank line after function; 2 found
-------------------------------------------------------------------------------------------------


FILE: /regex_redirect/src/Plugin/Field/FieldWidget/RegexRedirectSourceWidget.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
-------------------------------------------------------------------------------------------------------------------------------
 140 | ERROR | [x] Array indentation error, expected 12 spaces but found 14
 141 | ERROR | [x] Array indentation error, expected 12 spaces but found 14
 142 | ERROR | [x] Array indentation error, expected 12 spaces but found 14
 143 | ERROR | [x] Array closing indentation error, expected 10 spaces but found 12
-------------------------------------------------------------------------------------------------------------------------------


FILE: /regex_redirect/src/Form/RegexRedirectDeleteForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
 62 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /regex_redirect/src/Form/RegexRedirectSettingsForm.php
-----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
 15 | ERROR | Missing short description in doc comment
-----------------------------------------------------------------------------------------------------------


FILE: /regex_redirect/src/Form/RegexRedirectForm.php
---------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
---------------------------------------------------------------------------------------------------
  25 | ERROR   | [x] Data types in @throws tags need to be fully namespaced
 146 | ERROR   | [x] Data types in @throws tags need to be fully namespaced
 250 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------


FILE: /regex_redirect/tests/src/Unit/RegexRedirectRepositoryTest.php
-------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------
 236 | ERROR | [x] Missing function doc comment
-------------------------------------------------------------------------------------------------------------------

Proposed resolution

Fix the errors as per Drupal best practices and coding standards.

User interface changes

NONE

API changes

NONE

Data model changes

NONE

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India ankithashetty Karnataka, India

Live updates comments and jobs are added and updated live.
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.

Production build 0.69.0 2024