Problem/Motivation

FILE: /var/www/html/drupal9/web/modules/contrib/image_field_caption/src/ImageCaptionItem.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
8 | ERROR | Doc comment is empty
40 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
42 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
48 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

Comments

yashmalviya created an issue. See original summary.

yashmalviya’s picture

Assigned: yashmalviya » Unassigned
Status: Active » Needs review
StatusFileSize
new10.32 KB

I have fixed the issue . Please review it

stefank’s picture

Status: Needs review » Needs work

Hi @yashmalviya ,

As this is mainly ok, I would suggest to change the issue title and description to fix Drupal coding standards and it should then cover all the files in the module/project. Or, you change only the relevant code which the title is suggesting.
Thanks

ashutosh ahirwal’s picture

Title: t() calls should be avoided in classes » Fix the issues reported by phpcs
Priority: Normal » Minor
Status: Needs work » Needs review
Issue tags: +Coding standards
StatusFileSize
new24.34 KB

Hi I have changed the title of this issue and also performed the issue fixes which was rised by below command.
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml web/modules/custom/image_field_caption

Providing patch with phpcs-issue-fixes.

paraderojether’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new286.63 KB
new128.8 KB

Hi @Ashutosh Ahirwal

I reviewed patch 4, applied it against Image Field Caption 8.x-1.2, and confirmed it fixes the errors/warnings that is reported by phpcs.

I added screenshots for reference.
Thank You.

istryker’s picture

StatusFileSize
new24.21 KB

Reroll due to other patches being applied.

istryker’s picture

Status: Reviewed & tested by the community » Fixed

Committed

Status: Fixed » Closed (fixed)

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