diff --git a/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php b/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php index 74340884d2..a6b8cf2b39 100644 --- a/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php +++ b/core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php @@ -181,7 +181,7 @@ public function prepareRow(Row $row) { } $field_data = unserialize($row->getSourceProperty('field_data')); - $row->setSourceProperty('field_settings', $field_data['settings']); + $row->setSourceProperty('field_settings', $field_data['settings'] ?? NULL); return parent::prepareRow($row); } diff --git a/core/modules/field/tests/src/Kernel/FieldFormatterTest.php b/core/modules/field/tests/src/Kernel/FieldFormatterTest.php index f61ea3ff3a..7d22271a69 100644 --- a/core/modules/field/tests/src/Kernel/FieldFormatterTest.php +++ b/core/modules/field/tests/src/Kernel/FieldFormatterTest.php @@ -98,7 +98,7 @@ public function testThirdPartySettings() { $entity->{$this->fieldName}->value = $this->randomString(); $build = $entity->{$this->fieldName}->view('default'); - $this->assertEquals($third_party_settings, $build['#third_party_settings']); + $this->assertEquals($third_party_settings, $build['#third_party_settings'] ?? NULL); } } diff --git a/core/modules/migrate/tests/src/Kernel/MigrateConfigRollbackTest.php b/core/modules/migrate/tests/src/Kernel/MigrateConfigRollbackTest.php index 27aa45bcce..1c5cdd49a4 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateConfigRollbackTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateConfigRollbackTest.php @@ -79,7 +79,7 @@ public function testConfigRollback() { $this->assertSame('Awesome slogan', $config->get('slogan')); // Confirm the map row is deleted. $map_row = $config_id_map->getRowBySource(['id' => $variable[0]['id']]); - $this->assertNull($map_row['destid1']); + $this->assertNull($map_row['destid1'] ?? NULL); // We use system configuration to demonstrate importing and rolling back // configuration translations. diff --git a/core/modules/taxonomy/src/Plugin/migrate/source/d6/TermLocalizedTranslation.php b/core/modules/taxonomy/src/Plugin/migrate/source/d6/TermLocalizedTranslation.php index 844fb858b5..d29b57be3c 100644 --- a/core/modules/taxonomy/src/Plugin/migrate/source/d6/TermLocalizedTranslation.php +++ b/core/modules/taxonomy/src/Plugin/migrate/source/d6/TermLocalizedTranslation.php @@ -70,7 +70,7 @@ public function prepareRow(Row $row) { $query->condition('lt.language', $language); $query->addField('lt', 'translation'); $results = $query->execute()->fetchAssoc(); - $row->setSourceProperty($other_property . '_translated', $results['translation']); + $row->setSourceProperty($other_property . '_translated', $results['translation'] ?? NULL); parent::prepareRow($row); } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php index aa2a999f2d..4e44c67195 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php @@ -664,7 +664,7 @@ protected function doTestLanguageFallback($entity_type) { $controller = $this->entityTypeManager->getViewBuilder($entity_type); $build = $controller->view($entity); $renderer->renderRoot($build); - $this->assertEqual($build['label']['#markup'], $values[$current_langcode]['name'], 'By default the entity is rendered in the current language.'); + $this->assertEqual($build['label']['#markup'] ?? NULL, $values[$current_langcode]['name'], 'By default the entity is rendered in the current language.'); $langcodes = array_combine($this->langcodes, $this->langcodes); // We have no translation for the $langcode2 language, hence the expected diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php index 4172772be7..c3932c8b3a 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php @@ -194,7 +194,7 @@ public function testEntityViewBuilderWeight() { $renderer->renderRoot($view); // Check that the weight is respected. - $this->assertEqual($view['label']['#weight'], 20, 'The weight of a display component is respected.'); + $this->assertEqual($view['label']['#weight'] ?? NULL, 20, 'The weight of a display component is respected.'); } /** diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index 290e494aea..c354a38461 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -607,7 +607,7 @@ protected function tearDown() { $original_connection_info = Database::getConnectionInfo('simpletest_original_default'); $original_prefix = $original_connection_info['default']['prefix']['default'] ?? NULL; $test_connection_info = Database::getConnectionInfo('default'); - $test_prefix = $test_connection_info['default']['prefix']['default']; + $test_prefix = $test_connection_info['default']['prefix']['default'] ?? NULL; if ($original_prefix != $test_prefix) { $tables = Database::getConnection()->schema()->findTables('%'); foreach ($tables as $table) {