From 351d80d122a369774a7807abae634f09bc933c23 Mon Sep 17 00:00:00 2001 From: Andreas Hennings <andreas@dqxtech.net> Date: Tue, 29 Mar 2022 09:52:26 +0200 Subject: [PATCH] OEL-1281: Drop defensive code for impossible cases. Use `@var` doc to document that variable won't be NULL. --- .../oe_whitelabel_paragraphs.install | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install index 4d221d23..e7448aaf 100644 --- a/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install +++ b/modules/oe_whitelabel_paragraphs/oe_whitelabel_paragraphs.install @@ -144,16 +144,10 @@ function _oe_whitelabel_paragraphs_install_migrate_field_data(array $field_names $paragraph_ids = $query->execute(); foreach ($paragraph_ids as $revision_id => $paragraph_id) { + // Revision can't be NULL. + /** @var \Drupal\paragraphs\ParagraphInterface $paragraph_revision */ $paragraph_revision = $paragraphs_storage->loadRevision($revision_id); - if (!$paragraph_revision) { - // Revision not found - this is unexpected, but survivable. - continue; - } - $field_names_map = $field_names_by_bundle[$paragraph_revision->bundle()] ?? []; - if (!$field_names_map) { - // No field names to migrate - this is unexpected. - continue; - } + $field_names_map = $field_names_by_bundle[$paragraph_revision->bundle()]; $modified = FALSE; foreach ($field_names_map as $dest_field_name => $source_field_name) { if ($paragraph_revision->get($source_field_name)->isEmpty()) { -- GitLab