Problem/Motivation

Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml shows the following warning which should be fixed.

FILE: /web/modules/custom/media_thumbnails/src/Form/MediaThumbnailConfigForm.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
-----------------------------------------------------------------------------------------------------------------------------------------
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Andrii Momotov created an issue. See original summary.

andrii momotov’s picture

Status: Needs work » Needs review

Fixed the warning reported by PHP_CodeSniffer and created MR. Please review. Thanks!

andrii momotov’s picture

Issue summary: View changes
andrii momotov’s picture

Assigned: andrii momotov » Unassigned

Fixed the warning reported by PHP_CodeSniffer and created MR. Please review. Thanks!

paraderojether’s picture

Assigned: Unassigned » paraderojether
paraderojether’s picture

Status: Needs review » Needs work

Hi

I reviewed MR!4, applied against Media Thumbnails 8.x-1.x-dev and there is one phpcs error shown below:

✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig media_thumbnails

FILE: /Users/jetherparadero/Contributions/recommended-project/web/modules/contrib/media_thumbnails/src/Plugin/MediaThumbnailManager.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------
 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Cache\CacheBackendInterface.
---------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------

Time: 350ms; Memory: 10MB

Thank you.

paraderojether’s picture

Assigned: paraderojether » Unassigned
Status: Needs work » Needs review

I fixed the remaining issue, please review.

Thank you.

riddhi.addweb’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new140.47 KB

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

renrhaf made their first commit to this issue’s fork.

renrhaf’s picture

Status: Reviewed & tested by the community » Fixed

Merged, thank you all!

  • renrhaf committed 656f1eb8 on media_thumbnails-3468533-3468533-set-up-gitlab authored by andrii momotov
    Issue #3468528: Fix the warning reported by PHP_CodeSniffer
    

Status: Fixed » Closed (fixed)

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