Problem/Motivation

This issue was found while working on #2824935: Fix Squiz.ControlStructures.SwitchDeclaration coding standard.

Drupal\field\Plugin\migrate\process\d7\FieldInstanceDefaults::transform() contains a switch statement with only a default statement. This violates the Squiz.ControlStructures.SwitchDeclaration coding standard: SWITCH statements must contain at least one CASE statement.

This issue is fixed separately, since it allows for discussion regarding the migration system rather than coding standards.

Proposed resolution

Refactor the code to remove the switch statement.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#2 2972045-2.patch780 bytesidebr
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review
FileSize
780 bytes

Attached patch removes the switch statement, since all actions result in the same return value. The first widget type that requires special processing can add the switch statement, or use an if-statement like the email_textfield does in the file.

borisson_’s picture

This looks very good, a nice simplification. I don't feel confident enough about the migration system to RTBC this issue.

jofitz’s picture

Status: Needs review » Reviewed & tested by the community

A nice, straightforward fix.

alexpott’s picture

Category: Bug report » Task
Status: Reviewed & tested by the community » Fixed

There's no bug here per se so changing to a task.

Committed 7c6d444 and pushed to 8.6.x. Thanks!

  • alexpott committed 7c6d444 on 8.6.x
    Issue #2972045 by idebr: Drupal\field\Plugin\migrate\process\d7\...

Status: Fixed » Closed (fixed)

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