Problem/Motivation
Getting following error/warnings:
FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\views_conditional\src\Plugin\views\field\ViewsConditionalField.php
----------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------------------
233 | ERROR | Missing parameter type
236 | ERROR | Return type missing for @return tag in function comment
263 | WARNING | Only string literals should be passed to t() where possible
266 | WARNING | Only string literals should be passed to t() where possible
----------------------------------------------------------------------------------------------------------------------
FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\views_conditional\views_conditional.install
-----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
32 | WARNING | Unused variable $display_name.
-----------------------------------------------------------------------------------------------
Steps to reproduce
Run following command:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml views_conditional/
Proposed resolution
Above error/warnings need to be fixed.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3368593-PHPCS-fixed.png | 142.37 KB | clarkssquared |
| #2 | 3368593-2.patch | 2.09 KB | arti_parmar |
Comments
Comment #2
arti_parmar commentedKindly review patch.
Comment #3
clarkssquared commentedHi arti_parmar
I applied your patch #2 to the VIews Conditional Module v8.x-1.x-dev and I confirmed that your patch fixed all the PHPCS issues.
Please look at the screenshot attached for your reference
Thank you
Comment #4
shelaneRemoving translation from an if statement specifically intended on providing translation is not how to fix the t usage issue.
Comment #6
shelaneI have verified the current use case of t() with the variables:
I've applied these fixes and more that come up with I check for strict rules.