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

Command icon 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

samit.310@gmail.com created an issue. See original summary.

samitk’s picture

StatusFileSize
new8.95 KB

Issue fixed.

Jacoboa’s picture

Hi! 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?

samitk’s picture

Assigned: samitk » Unassigned
Status: Needs work » Needs review

Hi @Jacoboa, sorry I missed to change the status.

Status: Needs review » Needs work

The last submitted patch, 2: phpcs-error-3324088-2.patch, failed testing. View results

Arturo-q’s picture

Version: 4.0.0 » 4.x-dev
Assigned: Unassigned » Arturo-q

Hi, 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 using 4.x-dev.

Arturo-q’s picture

Assigned: Arturo-q » Unassigned
StatusFileSize
new10.81 KB
new1.82 KB

Hi, 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.

urvashi_vora’s picture

Assigned: Unassigned » urvashi_vora
Status: Needs work » Needs review

Hi,

I will review this.

Status: Needs review » Needs work

The last submitted patch, 7: 3324088-7.patch, failed testing. View results

urvashi_vora’s picture

Since the patch failed in automated testing, I will work on this.

urvashi_vora’s picture

Assigned: urvashi_vora » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.25 KB

Hi,

Please review this.

Thanks

Status: Needs review » Needs work

The last submitted patch, 11: coding-standard-fixes-3324088-11.patch, failed testing. View results

christyanpaim’s picture

Assigned: Unassigned » christyanpaim
christyanpaim’s picture

Assigned: christyanpaim » Unassigned
Status: Needs work » Needs review
StatusFileSize
new10.86 KB

Fixed the remaining phpcs issue

Status: Needs review » Needs work

The last submitted patch, 14: 3324088-14.patch, failed testing. View results

hmendes’s picture

Status: Needs work » Needs review
StatusFileSize
new12.64 KB

Fixing tests.

lucienchalom’s picture

Status: Needs review » Reviewed & tested by the community

the coding standards are clean, and the tests are fine.
I tested the module with the patch applied and worked as expected.

  • hmendes authored 4818682f on 4.x
    Issue #3324088 by urvashi_vora, Arturo1007, samit.310@gmail.com,...
hmendes’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.