Problem/Motivation
Getting following error/warnings
FILE: /app/modules/contrib/select_or_other/src/Element/ElementBase.php
---------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
---------------------------------------------------------------------------
135 | ERROR | [x] Use null coalesce operator instead of ternary operator.
154 | ERROR | [x] Use null coalesce operator instead of ternary operator.
204 | ERROR | [x] Use null coalesce operator instead of ternary operator.
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------
FILE: /app/modules/contrib/select_or_other/src/Plugin/Field/FieldWidget/ListWidget.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------
57 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
142 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/select_or_other/src/Plugin/Field/FieldWidget/ReferenceWidget.php
-------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------
242 | ERROR | [x] Use null coalesce operator instead of ternary operator.
297 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/select_or_other/tests/src/Unit/ButtonsElementTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
58 | ERROR | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: /app/modules/contrib/select_or_other/tests/src/Unit/ElementsTest.php
---------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------
132 | ERROR | [x] Use null coalesce operator instead of ternary operator.
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------
FILE: /app/modules/contrib/select_or_other/tests/src/Unit/ListWidgetTest.php
----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------
59 | ERROR | [x] list(...) is forbidden, use [...] instead.
----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------
FILE: /app/modules/contrib/select_or_other/tests/src/Unit/SelectElementTest.php
-------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------
58 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------
Time: 465ms; Memory: 12MB
Steps to reproduce
Run following command
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/select_or_other/
Proposed resolution
Above error need to be fixed
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 3324088-16.patch | 12.64 KB | hmendes |
| #14 | 3324088-14.patch | 10.86 KB | christyanpaim |
| #11 | coding-standard-fixes-3324088-11.patch | 2.25 KB | urvashi_vora |
| #7 | interdiff-2-7.txt | 1.82 KB | Arturo-q |
| #7 | 3324088-7.patch | 10.81 KB | Arturo-q |
Issue fork select_or_other-3324088
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
samitk commentedIssue fixed.
Comment #3
Jacoboa commentedHi! I see you are still assigned to the issue and the status is still "Needs Work", but I see that the patch does remove the CS errors, is the issue ready for review or not yet?
Comment #4
samitk commentedHi @Jacoboa, sorry I missed to change the status.
Comment #6
Arturo-q commentedHi, I believe that the right branch for the issue is
4.x-dev, the patch didn't apply on 4.0.0, so, I will review it using4.x-dev.Comment #7
Arturo-q commentedHi, I reviewed the patch, and all CS errors were fixed, however, It is necessary to update the unit test, I was working on it and made a patch, (it needs work), not sure if it's the best approach though.
Comment #8
urvashi_vora commentedHi,
I will review this.
Comment #10
urvashi_vora commentedSince the patch failed in automated testing, I will work on this.
Comment #11
urvashi_vora commentedHi,
Please review this.
Thanks
Comment #13
christyanpaim commentedComment #14
christyanpaim commentedFixed the remaining phpcs issue
Comment #16
hmendes commentedFixing tests.
Comment #17
lucienchalom commentedthe coding standards are clean, and the tests are fine.
I tested the module with the patch applied and worked as expected.
Comment #19
hmendes commentedThanks!