Problem/Motivation
FILE: ...ontrib/image_field_360/src/Plugin/Field/FieldFormatter/Image_field_360.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
23 | ERROR | Class name must use UpperCamel naming without underscores
295 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
295 | WARNING | Only string literals should be passed to t() where possible
--------------------------------------------------------------------------------
FILE: ...ution/drupal10/web/modules/contrib/image_field_360/image_field_360.install
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
24 | ERROR | [x] Expected newline after closing brace
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 453ms; Memory: 10MB
Steps to reproduce
Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig image_field_360/
Proposed resolution
Fix all the issues and warnings for Drupal and DrupalPractice coding standards.
Remaining tasks
Patch review.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | Screenshot from 2023-05-25 18-02-27.png | 99.25 KB | raveen_thakur51 |
| #8 | interdiff-6_8.txt | 521 bytes | urvashi_vora |
| #8 | coding-standard-fixes-8.patch | 1.73 KB | urvashi_vora |
| #6 | interdiff-4_6.txt | 712 bytes | urvashi_vora |
| #6 | coding-standard-fixes-6.patch | 1.68 KB | urvashi_vora |
Comments
Comment #2
avpadernoThe src/Plugin/Field/FieldFormatter/Image_field_360.php file has been deleted, but no other file has been added. The error shown in the report does not say that file must be removed; it says the class name must be changed.
Comment #3
avpadernoComment #4
urvashi_vora commentedHi @apaderno,
For the feedback:
I appreciate your efforts in addressing the error regarding the class name and file naming convention. As per the error message, it was necessary to change the class name and subsequently rename the file to ensure that they match. I understand that during this process, the renamed file ended up being untracked in Git, while the deleted file remained tracked. Consequently, when checking the Git diff, only the deleted file was captured, excluding the changes made to the renamed file.
I have now updated the patch to include both changes. I kindly request you to verify the updated patch to ensure that both modifications are properly reflected. Thank you for your attention to detail and your cooperation in resolving this issue.
Comment #5
avpadernoIt is not necessary to change the plugin ID. It is not required to match the class name; furthermore, plugin IDs use snail case. See AggregatorTitleFormatter.php, for example.
Since that documentation comment is changed, also the description must be changed. The description for a constructor must start with
Constructs a newfollowed by the class name (including its namespace), and end withobject.Comment #6
urvashi_vora commentedReverted plugin ID and added the word "new" in constructor comment.
Please review.
Thanks
Comment #7
avpadernoThe class namespace is still missing, which is what the previous review reported as change too.
Comment #8
urvashi_vora commentedPlease review.
Comment #9
raveen_thakur51 commented@urvashi, after applying the #patch8, all the phpcs issues seem to be resolved.
As you can see in my attached screenshot.
Please & Thank You.
Comment #10
m.abdulqader commentedComment #12
m.abdulqader commented