FILE: /var/www/html/dcontri/charts_twig/src/ChartsTwig.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 8 WARNINGS AFFECTING 6 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
29 | ERROR | [x] You must use "/**" style comments for a function comment
35 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
35 | WARNING | [ ] Only string literals should be passed to t() where possible
42 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
42 | WARNING | [ ] Only string literals should be passed to t() where possible
48 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
48 | WARNING | [ ] Only string literals should be passed to t() where possible
53 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
53 | WARNING | [ ] Only string literals should be passed to t() where possible
---------------------------------------------------------------------------------------------------------------------------------------------
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3336007-avoid-t-8.patch | 3 KB | andileco |
| #4 | 3336007-4.patch | 1.7 KB | akshay.singh |
| #2 | 3336007-2.patch | 1.22 KB | gayatri chahar |
Issue fork charts_twig-3336007
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
Comment #2
gayatri chahar commentedPatch created. Please review it
Comment #3
akshay.singh commentedI will review this.
Thanks
Comment #4
akshay.singh commentedAfter applying the above patch. I found the string literal issues along with the formatting issues and fixed them.
Please check.
Thanks
Comment #5
hardikpandya commentedI see the patch is applying and all the issues are fixed. Marking as RTBC.
Comment #7
andileco commentedThank you all for your patches. The base class does not have the string translation method, so it was necessary to add the StringTranslationTrait in order to use $this->t(). I also added a couple adjustments to the docblock, parameters while I was in the code.
Comment #8
andileco commentedOK, so right after I created the last patch, I did some testing and realized the $this->t() was not getting reached. If you want to translate, you need to use |t or |trans in the Twig code itself. I added documentation in the README. I also replaced $this->t() with Xss::filter() to provide additional controls on the strings that users can input.
Comment #10
andileco commented