t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead

Created on 20 June 2023, about 1 year ago
Updated 20 February 2024, 4 months ago

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\crop\src\CropTypeListBuilder.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------
71 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
112 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
131 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\crop\src\Entity\Crop.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
124 | WARNING | Exceptions should not be translated
124 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\crop\src\Form\CropTypeDeleteForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
47 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
61 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\crop\tests\src\Functional\CropFunctionalTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 13 WARNINGS AFFECTING 13 LINES
------------------------------------------------------------------------------------------------------------------------------------------
85 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
86 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
89 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
103 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
112 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
113 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
126 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
127 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
146 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
152 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
153 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
157 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
158 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\crop\tests\src\Kernel\CropCRUDTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 16 WARNINGS AFFECTING 16 LINES
------------------------------------------------------------------------------------------------------------------------------------------
68 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
69 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
70 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
75 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
76 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
77 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
103 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
104 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
105 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
106 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
109 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
110 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
111 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
112 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
113 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
114 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\crop\tests\src\Kernel\CropEffectTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
95 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

๐Ÿ“Œ Task
Status

Needs review

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia arti_parmar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @arti_parmar
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia arti_parmar

    Kindly review patch.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines kenyoOwen

    Hi arti_parmar

    I applied your patch and confirmed that the phpcs issues mentioned are resolved, but your patch has errors that also add an error in phpcs maybe fix it.

    :77: trailing whitespace.

    :79: trailing whitespace.

    :117: trailing whitespace.

    Checking patch src/CropTypeListBuilder.php...
    Checking patch src/Entity/Crop.php...
    Checking patch src/Form/CropTypeDeleteForm.php...
    Checking patch tests/src/Functional/CropFunctionalTest.php...
    Checking patch tests/src/Kernel/CropCRUDTest.php...
    Checking patch tests/src/Kernel/CropEffectTest.php...
    Applied patch src/CropTypeListBuilder.php cleanly.
    Applied patch src/Entity/Crop.php cleanly.
    Applied patch src/Form/CropTypeDeleteForm.php cleanly.
    Applied patch tests/src/Functional/CropFunctionalTest.php cleanly.
    Applied patch tests/src/Kernel/CropCRUDTest.php cleanly.
    Applied patch tests/src/Kernel/CropEffectTest.php cleanly.
    warning: 3 lines add whitespace errors.

    Please see the screenshots attached.

    Thank you.

  • Assigned to nitin_lama
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama

    Addressed #3. Please review. Thanks

  • Issue was unassigned.
  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    -    // TODO - we are not enforcing uniqueness on this as we want to support more
    +    // ---.
    +    // @todo we are not enforcing uniqueness on this as we want to support more
         // crops per same image/image_style combination. However, image effect

    What follows @todo is a sentence: It starts with a capitalized word and it ends with a period (preferable), a question mark, or an exclamation point.

    Anyway, since this issue is focusing on removing any call to t() in classes, that is an off-topic change.

     class CropTypeDeleteForm extends EntityConfirmFormBase {
     
    +  use StringTranslationTrait;
    +
    

    That line is not necessary, since FormBase, one of the parent classes, use that already.

    -    $this->assertSession()->pageTextContains(t('No crop types available.'));
    -    $this->assertSession()->linkExists(t('Add crop type'));
    +    $this->assertSession()->pageTextContains($this->t('No crop types available.'));
    +    $this->assertSession()->linkExists($this->t('Add crop type'));

    That is the wrong change, since test classes should not use t() nor $this->t(). Anyway, that is an off-topic change for an issue to aim to replace t() calls: The existing code lines do not call t().

         if (!$plugin_manager->hasDefinition($this->entity_type->value)) {
    -      throw new EntityProviderNotFoundException(t('Entity provider @id not found.', ['@id' => $this->entity_type->value]));
    +      throw new EntityProviderNotFoundException("Entity provider @id not found.", $this->entity_type->value);
         }

    The changed code is not equivalent to the existing code: The existing code passes a single argument to the constructor for EntityProviderNotFoundException; the changed code passes two arguments to the same constructor.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kbk1992 Hyderabad

    bharath-kondeti โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 12 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kbk1992 Hyderabad
  • Status changed to Needs work 12 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chaitanyadessai

    Please review patch.

  • Assigned to nitin_lama
  • Issue was unassigned.
Production build 0.69.0 2024