diff --git a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php index 730e5390cb5259dd1b14f22e93a19e797f6e67e0..56f0da64fe8c6c0b2c7fd1a56b48ddad3ec69186 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php +++ b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php @@ -100,9 +100,10 @@ protected function hasUntranslatableFieldsChanges(ContentEntityInterface $entity $original = $entity->original; } else { - $original = $this->entityTypeManager - ->getStorage($entity->getEntityTypeId()) - ->loadRevision($entity->getLoadedRevisionId()); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = $this->entityTypeManager + ->getStorage($entity->getEntityTypeId()); + $original = $storage->loadRevision($entity->getLoadedRevisionId()); } foreach ($entity->getFieldDefinitions() as $field_name => $definition) { diff --git a/core/lib/Drupal/Core/ParamConverter/EntityRevisionParamConverter.php b/core/lib/Drupal/Core/ParamConverter/EntityRevisionParamConverter.php index f7aeaf36619537f3d0c52c2ff5cdb554c068886c..afc33b6bbf7cb090348b786072d608e66733668b 100644 --- a/core/lib/Drupal/Core/ParamConverter/EntityRevisionParamConverter.php +++ b/core/lib/Drupal/Core/ParamConverter/EntityRevisionParamConverter.php @@ -61,7 +61,9 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Ent */ public function convert($value, $definition, $name, array $defaults) { $entity_type_id = $this->getEntityTypeFromDefaults($definition, $name, $defaults); - $entity = $this->entityTypeManager->getStorage($entity_type_id)->loadRevision($value); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = $this->entityTypeManager->getStorage($entity_type_id); + $entity = $storage->loadRevision($value); // If the entity type is translatable, ensure we return the proper // translation object for the current context. diff --git a/core/modules/content_moderation/src/Entity/ContentModerationState.php b/core/modules/content_moderation/src/Entity/ContentModerationState.php index fabce0090f52edd91c4d07173777a7de30029890..31d7856194a37f70283c0d9910d63919b935cbbf 100644 --- a/core/modules/content_moderation/src/Entity/ContentModerationState.php +++ b/core/modules/content_moderation/src/Entity/ContentModerationState.php @@ -161,8 +161,10 @@ public static function loadFromModeratedEntity(EntityInterface $entity) { * {@inheritdoc} */ public function save() { - $related_entity = \Drupal::entityTypeManager() - ->getStorage($this->content_entity_type_id->value) + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = \Drupal::entityTypeManager() + ->getStorage($this->content_entity_type_id->value); + $related_entity = $storage ->loadRevision($this->content_entity_revision_id->value); if ($related_entity instanceof TranslatableInterface) { $related_entity = $related_entity->getTranslation($this->activeLangcode); diff --git a/core/modules/content_moderation/src/ModerationInformation.php b/core/modules/content_moderation/src/ModerationInformation.php index a41b154f279d1086f099ebb64d56659e783c5494..78d0dc6014acfca79622a8ad9349302c6b582b28 100644 --- a/core/modules/content_moderation/src/ModerationInformation.php +++ b/core/modules/content_moderation/src/ModerationInformation.php @@ -120,7 +120,7 @@ public function getAffectedRevisionTranslation(ContentEntityInterface $entity) { public function hasPendingRevision(ContentEntityInterface $entity) { $result = FALSE; if ($this->isModeratedEntity($entity)) { - /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */ + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); $latest_revision_id = $storage->getLatestTranslationAffectedRevisionId($entity->id(), $entity->language()->getId()); $default_revision_id = $entity->isDefaultRevision() && !$entity->isNewRevision() && ($revision_id = $entity->getRevisionId()) ? @@ -215,8 +215,10 @@ public function getOriginalState(ContentEntityInterface $entity) { $state = NULL; $workflow_type = $this->getWorkflowForEntity($entity)->getTypePlugin(); if (!$entity->isNew() && !$this->isFirstTimeModeration($entity)) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); /** @var \Drupal\Core\Entity\ContentEntityInterface $original_entity */ - $original_entity = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->loadRevision($entity->getLoadedRevisionId()); + $original_entity = $storage->loadRevision($entity->getLoadedRevisionId()); if (!$entity->isDefaultTranslation() && $original_entity->hasTranslation($entity->language()->getId())) { $original_entity = $original_entity->getTranslation($entity->language()->getId()); } @@ -240,6 +242,7 @@ public function getOriginalState(ContentEntityInterface $entity) { * TRUE if this is the entity's first time being moderated, FALSE otherwise. */ protected function isFirstTimeModeration(ContentEntityInterface $entity) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); $original_entity = $storage->loadRevision($storage->getLatestRevisionId($entity->id())); diff --git a/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php index f5ae4c6be3ef413deac68580f194214bb88c51b4..e641dbb8d5b6da14e75af1faaf68b5c3375ed8c5 100644 --- a/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php +++ b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php @@ -125,8 +125,10 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen // The moderation state of the saved revision will be used to display the // current state as well determine the appropriate transitions. if (!$entity->isNew()) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); /** @var \Drupal\Core\Entity\ContentEntityInterface $original_entity */ - $original_entity = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->loadRevision($entity->getLoadedRevisionId()); + $original_entity = $storage->loadRevision($entity->getLoadedRevisionId()); if (!$entity->isDefaultTranslation() && $original_entity->hasTranslation($entity->language()->getId())) { $original_entity = $original_entity->getTranslation($entity->language()->getId()); } diff --git a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php index 4cdf77d837402e003eafdc35396a8f331e6381f9..6317a1f4ec5dc67008b5dec117fe9d11aa7a39c2 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php @@ -150,6 +150,7 @@ public function testBasicModeration($entity_type_id) { $entity->save(); // Revert to the previous (published) revision. + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $entity_storage */ $entity_storage = $this->entityTypeManager->getStorage($entity_type_id); $previous_revision = $entity_storage->loadRevision(4); $previous_revision->isDefaultRevision(TRUE); @@ -780,6 +781,7 @@ protected function createEntity($entity_type_id, $moderation_state = 'published' * The reloaded entity. */ protected function reloadEntity(EntityInterface $entity, $revision_id = FALSE) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage($entity->getEntityTypeId()); $storage->resetCache([$entity->id()]); if ($revision_id) { diff --git a/core/modules/content_moderation/tests/src/Kernel/ContentModerationSyncingTest.php b/core/modules/content_moderation/tests/src/Kernel/ContentModerationSyncingTest.php index 4a14164585102d073dd36d06c29aa474bbf5ed58..9e0dfa5db41e6f68f7cc52dd08f72bf6e9f9ae78 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ContentModerationSyncingTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ContentModerationSyncingTest.php @@ -115,6 +115,7 @@ public function testMultipleRevisionStateChangedDuringSync() { * Tests modifying a previous revision during a sync. */ public function testUpdatingPreviousRevisionDuringSync() { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->container->get('entity_type.manager')->getStorage('entity_test_mulrevpub'); $entity = EntityTestMulRevPub::create([ @@ -142,6 +143,7 @@ public function testUpdatingPreviousRevisionDuringSync() { * Tests a moderation state changed on a previous revision during a sync. */ public function testStateChangedPreviousRevisionDuringSync() { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->container->get('entity_type.manager')->getStorage('entity_test_mulrevpub'); $entity = EntityTestMulRevPub::create([ @@ -188,6 +190,7 @@ public function testStateChangedPreviousRevisionDuringSync() { * An array of revision names. */ protected function getAllRevisionNames(EntityTestMulRevPub $entity) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->container->get('entity_type.manager')->getStorage('entity_test_mulrevpub'); return array_map(function ($revision_id) use ($storage) { return $storage->loadRevision($revision_id)->name->value; diff --git a/core/modules/content_translation/src/FieldTranslationSynchronizer.php b/core/modules/content_translation/src/FieldTranslationSynchronizer.php index 336909d2a7e89d6f00cdd95a2746ff6189429501..3719b0a5cbb43f6feefd04e6fb132e49e8b5de3e 100644 --- a/core/modules/content_translation/src/FieldTranslationSynchronizer.php +++ b/core/modules/content_translation/src/FieldTranslationSynchronizer.php @@ -190,6 +190,7 @@ public function synchronizeFields(ContentEntityInterface $entity, $sync_langcode */ protected function getOriginalEntity(ContentEntityInterface $entity) { if (!isset($entity->original)) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); $original = $entity->isDefaultRevision() ? $storage->loadUnchanged($entity->id()) : $storage->loadRevision($entity->getLoadedRevisionId()); } diff --git a/core/modules/content_translation/src/Plugin/Validation/Constraint/ContentTranslationSynchronizedFieldsConstraintValidator.php b/core/modules/content_translation/src/Plugin/Validation/Constraint/ContentTranslationSynchronizedFieldsConstraintValidator.php index 127b6452b2266667e497ce2fd748afd94a86369d..e52a18081064ddcdcd48777a401801253f183803 100644 --- a/core/modules/content_translation/src/Plugin/Validation/Constraint/ContentTranslationSynchronizedFieldsConstraintValidator.php +++ b/core/modules/content_translation/src/Plugin/Validation/Constraint/ContentTranslationSynchronizedFieldsConstraintValidator.php @@ -170,6 +170,7 @@ protected function hasSynchronizedPropertyChanges(ContentEntityInterface $entity */ protected function getOriginalEntity(ContentEntityInterface $entity) { if (!isset($entity->original)) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); $original = $entity->isDefaultRevision() ? $storage->loadUnchanged($entity->id()) : $storage->loadRevision($entity->getLoadedRevisionId()); } diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php index 85e2d8a1b2cc1ac8dc504827ff0b8679a058de49..cc94de8cdf88c4b6c911433dc893ea081c59ce2a 100644 --- a/core/modules/field/tests/src/Functional/FormTest.php +++ b/core/modules/field/tests/src/Functional/FormTest.php @@ -578,9 +578,10 @@ public function testFieldFormAccess() { $this->assertEquals(2, $entity->{$field_name}->value, 'New revision has the expected value for the field with edit access.'); // Check that the revision is also saved in the revisions table. - $entity = $this->container->get('entity_type.manager') - ->getStorage($entity_type) - ->loadRevision($entity->getRevisionId()); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = $this->container->get('entity_type.manager') + ->getStorage($entity_type); + $entity = $storage->loadRevision($entity->getRevisionId()); $this->assertEquals(99, $entity->{$field_name_no_access}->value, 'New revision has the expected value for the field with no edit access.'); $this->assertEquals(2, $entity->{$field_name}->value, 'New revision has the expected value for the field with edit access.'); } diff --git a/core/modules/field/tests/src/Functional/TranslationWebTest.php b/core/modules/field/tests/src/Functional/TranslationWebTest.php index 54b1faf9d46a2e17eb178e5a16ed1e76f2c2ed94..30f01f4b8c1f1098effbcb69f75d747f968f3988 100644 --- a/core/modules/field/tests/src/Functional/TranslationWebTest.php +++ b/core/modules/field/tests/src/Functional/TranslationWebTest.php @@ -139,9 +139,10 @@ public function testFieldFormTranslationRevisions() { */ private function checkTranslationRevisions($id, $revision_id, $available_langcodes) { $field_name = $this->fieldStorage->getName(); - $entity = $this->container->get('entity_type.manager') - ->getStorage($this->entityTypeId) - ->loadRevision($revision_id); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = $this->container->get('entity_type.manager') + ->getStorage($this->entityTypeId); + $entity = $storage->loadRevision($revision_id); foreach ($available_langcodes as $langcode => $value) { $passed = $entity->getTranslation($langcode)->{$field_name}->value == $value + 1; $this->assertTrue($passed, new FormattableMarkup('The @language translation for revision @revision was correctly stored', ['@language' => $langcode, '@revision' => $entity->getRevisionId()])); diff --git a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php index 751ec5cd5a0ebc2e2fd368a93e076697089e1c3c..844a33c173c8353376bbda97e5e459f2cf88ddc9 100644 --- a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php +++ b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php @@ -50,6 +50,7 @@ public function testFieldAttachSaveLoad() { $values[$current_revision] = $current_values; } + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->container->get('entity_type.manager')->getStorage($entity_type); $storage->resetCache(); $entity = $storage->load($entity_id); @@ -252,6 +253,7 @@ public function testFieldAttachDelete() { $entity->setNewRevision(); $entity->save(); $vids[] = $entity->getRevisionId(); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $controller */ $controller = $this->container->get('entity_type.manager')->getStorage($entity->getEntityTypeId()); $controller->resetCache(); diff --git a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php index f521d6236bab866f7f424245f388806abf95e271..2610b31c0a5536a09e1be359901fbc1be350e927 100644 --- a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php +++ b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php @@ -136,6 +136,7 @@ public function testEntityCountAndHasData() { $this->assertTrue($this->fieldTestData->field_storage_2->hasData(), 'There are entities with field data.'); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->container->get('entity_type.manager')->getStorage($entity_type); $entity = $storage->loadRevision($first_revision); $this->assertCount($cardinality, $entity->{$this->fieldTestData->field_name_2}, new FormattableMarkup('Revision %revision_id: expected number of values.', ['%revision_id' => $first_revision])); diff --git a/core/modules/field/tests/src/Kernel/KernelString/StringFormatterTest.php b/core/modules/field/tests/src/Kernel/KernelString/StringFormatterTest.php index 36551fb4acb20febc47b3f8f3466e8a085f6bb41..bfae3d99a5ab97a4b879739c5f24f461b4102373 100644 --- a/core/modules/field/tests/src/Kernel/KernelString/StringFormatterTest.php +++ b/core/modules/field/tests/src/Kernel/KernelString/StringFormatterTest.php @@ -163,7 +163,9 @@ public function testStringFormatter() { $value2 = $this->randomMachineName(); $entity->{$this->fieldName}->value = $value2; $entity->save(); - $entity_new_revision = $this->entityTypeManager->getStorage('entity_test_rev')->loadRevision($old_revision_id); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = $this->entityTypeManager->getStorage('entity_test_rev'); + $entity_new_revision = $storage->loadRevision($old_revision_id); $this->renderEntityFields($entity, $this->display); $this->assertLink($value2, 0); diff --git a/core/modules/jsonapi/src/Revisions/NegotiatorBase.php b/core/modules/jsonapi/src/Revisions/NegotiatorBase.php index 2253090353aeca2aba463c7391e96825b8b881b6..35716f50a79d6bfb2f24e1ffe952eef85a6ce85f 100644 --- a/core/modules/jsonapi/src/Revisions/NegotiatorBase.php +++ b/core/modules/jsonapi/src/Revisions/NegotiatorBase.php @@ -75,6 +75,7 @@ public function getRevision(EntityInterface $entity, $version_argument) { * Thrown if the storage handler couldn't be loaded. */ protected function loadRevision(EntityInterface $entity, $revision_id) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); $revision = static::ensureVersionExists($storage->loadRevision($revision_id)); if ($revision->id() !== $entity->id()) { diff --git a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php index 2818fe4f4e551279a9ff6cbabb533911ce8d6fc2..976df970732b419bd8f5a3c3ce4f6985a5e0599c 100644 --- a/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php +++ b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php @@ -3129,9 +3129,14 @@ public function testRevisions() { [$revision_id, $relationship_url, $related_url] = $revision_case; // Load the revision that will be requested. $this->entityStorage->resetCache([$entity->id()]); - $revision = is_null($revision_id) - ? $this->entityStorage->load($entity->id()) - : $this->entityStorage->loadRevision($revision_id); + if ($revision_id === NULL) { + $revision = $this->entityStorage->load($entity->id()); + } + else { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = $this->entityStorage; + $revision = $storage->loadRevision($revision_id); + } // Request the relationship resource without access to the relationship // field. $actual_response = $this->request('GET', $relationship_url, $request_options); @@ -3156,9 +3161,14 @@ public function testRevisions() { [$revision_id, $relationship_url, $related_url] = $revision_case; // Load the revision that will be requested. $this->entityStorage->resetCache([$entity->id()]); - $revision = is_null($revision_id) - ? $this->entityStorage->load($entity->id()) - : $this->entityStorage->loadRevision($revision_id); + if ($revision_id === NULL) { + $revision = $this->entityStorage->load($entity->id()); + } + else { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = $this->entityStorage; + $revision = $storage->loadRevision($revision_id); + } // Request the relationship resource after granting access to the // relationship field. $actual_response = $this->request('GET', $relationship_url, $request_options); diff --git a/core/modules/media_library/src/MediaLibraryFieldWidgetOpener.php b/core/modules/media_library/src/MediaLibraryFieldWidgetOpener.php index e4ba1d69f3ec56ef3deb51266964ae5dcce306f7..b24051c71940f07cf3969165011745bbbd173d8b 100644 --- a/core/modules/media_library/src/MediaLibraryFieldWidgetOpener.php +++ b/core/modules/media_library/src/MediaLibraryFieldWidgetOpener.php @@ -60,6 +60,7 @@ public function checkAccess(MediaLibraryState $state, AccountInterface $account) throw new \LogicException("The media library can only be opened by fieldable entities."); } + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity_type_id); $access_handler = $this->entityTypeManager->getAccessControlHandler($entity_type_id); diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php index e11f257a34eb9b81146ae6f1ca9e0a8025e3f3b2..f4d565a6014c519ad06183df57532900eb33ffe1 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php @@ -59,10 +59,15 @@ protected function getEntity(Row $row, array $old_destination_id_values) { : $row->getDestinationProperty($this->getKey('revision')); // If we are re-running a migration with set revision IDs and the // destination revision ID already exists then do not create a new revision. - if (!empty($revision_id) && ($entity = $this->storage->loadRevision($revision_id))) { - $entity->setNewRevision(FALSE); + $entity = NULL; + if (!empty($revision_id)) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = $this->storage; + if ($entity = $storage->loadRevision($revision_id)) { + $entity->setNewRevision(FALSE); + } } - elseif (($entity_id = $row->getDestinationProperty($this->getKey('id'))) && ($entity = $this->storage->load($entity_id))) { + if ($entity === NULL && ($entity_id = $row->getDestinationProperty($this->getKey('id'))) && ($entity = $this->storage->load($entity_id))) { // We want to create a new entity. Set enforceIsNew() FALSE is necessary // to properly save a new entity while setting the ID. Without it, the // system would see that the ID is already set and assume it is an update. @@ -71,7 +76,7 @@ protected function getEntity(Row $row, array $old_destination_id_values) { // not be necessary, it is done for clarity. $entity->setNewRevision(TRUE); } - else { + if ($entity === NULL) { // Attempt to set the bundle. if ($bundle = $this->getBundle($row)) { $row->setDestinationProperty($this->getKey('bundle'), $bundle); diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php index 16d986999ced3733669b2d1f7cdd6f5a41a21c4e..25bf5c7e96ff0d96f50d5c48dbe8fa5e921de703 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php @@ -137,10 +137,15 @@ protected function getEntity(Row $row, array $old_destination_id_values) { $revision_id = $old_destination_id_values ? reset($old_destination_id_values) : $row->getDestinationProperty($this->getKey('revision')); - if (!empty($revision_id) && ($entity = $this->storage->loadRevision($revision_id))) { - $entity->setNewRevision(FALSE); + $entity = NULL; + if (!empty($revision_id)) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = $this->storage; + if ($entity = $storage->loadRevision($revision_id)) { + $entity->setNewRevision(FALSE); + } } - else { + if ($entity === NULL) { $entity_id = $row->getDestinationProperty($this->getKey('id')); $entity = $this->storage->load($entity_id); diff --git a/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php b/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php index c9724ad8197654187abcad10ca56e3489b8ae21a..56ab6e281f8f1cdd5bc016aee81537bfd0b919e6 100644 --- a/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php +++ b/core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php @@ -31,7 +31,7 @@ class EntityRevisionTest extends UnitTestCase { protected $migration; /** - * @var \Drupal\Core\Entity\EntityStorageInterface + * @var \Drupal\Core\Entity\RevisionableStorageInterface */ protected $storage; @@ -60,7 +60,7 @@ protected function setUp(): void { // Setup mocks to be used when creating a revision destination. $this->migration = $this->prophesize(MigrationInterface::class); - $this->storage = $this->prophesize('\Drupal\Core\Entity\EntityStorageInterface'); + $this->storage = $this->prophesize('\Drupal\Core\Entity\RevisionableStorageInterface'); $entity_type = $this->prophesize(EntityTypeInterface::class); $entity_type->getSingularLabel()->willReturn('crazy'); diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php index dc2a349ba462de44a38ca29370373d5bd0820c8f..cf664c9d0e055e8bafbcda3e7bb96e9efebd7fc1 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php @@ -28,7 +28,7 @@ class MigrateNodeCompleteTest extends MigrateNodeTestBase { /** * The entity storage for node. * - * @var \Drupal\Core\Entity\EntityStorageInterface + * @var \Drupal\Core\Entity\RevisionableStorageInterface */ protected $nodeStorage; diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php index ed3bc55add437c4a04fc79e7d707ab7d46423c57..f200e3059928cac1cca3da0d1d4da30f968a8adf 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php @@ -14,7 +14,7 @@ class MigrateNodeRevisionTest extends MigrateNodeTestBase { /** * The entity storage for node. * - * @var \Drupal\Core\Entity\EntityStorageInterface + * @var \Drupal\Core\Entity\RevisionableStorageInterface */ protected $nodeStorage; diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php index 3fb3d6ded683ce9a78c5e2e013b046f3ed993148..6c967d33f95fb76c1e6dca0cd3acdbe8ee331a1c 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php @@ -43,7 +43,7 @@ class MigrateNodeCompleteTest extends MigrateDrupal7TestBase { /** * The entity storage for node. * - * @var \Drupal\Core\Entity\EntityStorageInterface + * @var \Drupal\Core\Entity\RevisionableStorageInterface */ protected $nodeStorage; diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php index 04656656c2ac67bf6c0670629306c5a14b873f3e..b45fed752845eeda16112c7f2277f6dd8d1b0073 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php @@ -18,7 +18,7 @@ class MigrateNodeRevisionTest extends MigrateDrupal7TestBase { /** * The entity storage for node. * - * @var \Drupal\Core\Entity\EntityStorageInterface + * @var \Drupal\Core\Entity\RevisionableStorageInterface */ protected $nodeStorage; diff --git a/core/modules/views/src/Plugin/views/field/BulkForm.php b/core/modules/views/src/Plugin/views/field/BulkForm.php index 32afb60995b317e0f3caa8a7f90386bfd9b31411..a2552bdca7d0b90f553fdf47db9a6bea317a89d4 100644 --- a/core/modules/views/src/Plugin/views/field/BulkForm.php +++ b/core/modules/views/src/Plugin/views/field/BulkForm.php @@ -551,7 +551,13 @@ protected function loadEntityFromBulkFormKey($bulk_form_key) { // Load the entity or a specific revision depending on the given key. $storage = $this->entityTypeManager->getStorage($this->getEntityType()); - $entity = $revision_id ? $storage->loadRevision($revision_id) : $storage->load($id); + if ($revision_id) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $entity = $storage->loadRevision($revision_id); + } + else { + $entity = $storage->load($id); + } if ($entity instanceof TranslatableInterface) { $entity = $entity->getTranslation($langcode); diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php index 0247bf8c67d9554aacaffcf81b87d9cbdc17a444..e1ee41bf695f71f08d72b0b8c3b53d6ab125516a 100644 --- a/core/modules/views/src/Plugin/views/query/Sql.php +++ b/core/modules/views/src/Plugin/views/query/Sql.php @@ -1633,6 +1633,7 @@ public function loadEntities(&$results) { // Now load all revisions. foreach ($revision_ids_by_type as $entity_type => $revision_ids) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $entity_storage */ $entity_storage = $this->entityTypeManager->getStorage($entity_type); $entities = []; diff --git a/core/modules/workspaces/src/Plugin/Validation/Constraint/EntityWorkspaceConflictConstraintValidator.php b/core/modules/workspaces/src/Plugin/Validation/Constraint/EntityWorkspaceConflictConstraintValidator.php index ac053eba8cb8b83c79e53074b2505355896c2231..64ddf9238399ba209c224545ef31bf3359a6a9de 100644 --- a/core/modules/workspaces/src/Plugin/Validation/Constraint/EntityWorkspaceConflictConstraintValidator.php +++ b/core/modules/workspaces/src/Plugin/Validation/Constraint/EntityWorkspaceConflictConstraintValidator.php @@ -86,6 +86,7 @@ public function validate($entity, Constraint $constraint) { // Get the latest revision of the entity in order to check if it's being // edited in a different workspace. $latest_revision = $this->workspaceManager->executeOutsideWorkspace(function () use ($entity) { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId()); return $storage->loadRevision($storage->getLatestRevisionId($entity->id())); }); diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon index c0f306c2c17b187193e95b31f97ba5c2ab4af18b..e975c5f19b10ea13808329afc7b8ad0315e3759e 100644 --- a/core/phpstan-baseline.neon +++ b/core/phpstan-baseline.neon @@ -547,15 +547,6 @@ parameters: count: 2 path: lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php - - message: "#^Variable \\$value in isset\\(\\) always exists and is not nullable\\.$#" count: 1 @@ -816,15 +807,6 @@ parameters: count: 1 path: lib/Drupal/Core/Menu/MenuTreeStorage.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: lib/Drupal/Core/ParamConverter/EntityRevisionParamConverter.php - - message: "#^Constructor of class Drupal\\\\Core\\\\Queue\\\\Memory has an unused parameter \\$name\\.$#" count: 1 @@ -1140,29 +1122,11 @@ parameters: count: 1 path: modules/contact/src/MessageForm.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/content_moderation/src/Entity/ContentModerationState.php - - message: "#^Variable \\$state in isset\\(\\) always exists and is not nullable\\.$#" count: 3 path: modules/content_moderation/src/Form/ContentModerationStateForm.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 2 - path: modules/content_moderation/src/ModerationInformation.php - - message: "#^Method Drupal\\\\content_moderation\\\\ModerationInformation\\:\\:getAffectedRevisionTranslation\\(\\) should return Drupal\\\\Core\\\\Entity\\\\ContentEntityInterface but return statement is missing\\.$#" count: 1 @@ -1173,33 +1137,6 @@ parameters: count: 1 path: modules/content_moderation/src/ModerationInformation.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 2 - path: modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 3 - path: modules/content_moderation/tests/src/Kernel/ContentModerationSyncingTest.php - - message: "#^Variable \\$checkbox_id might not be defined\\.$#" count: 1 @@ -1230,24 +1167,6 @@ parameters: count: 1 path: modules/content_translation/src/Controller/ContentTranslationController.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/content_translation/src/FieldTranslationSynchronizer.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/content_translation/src/Plugin/Validation/Constraint/ContentTranslationSynchronizedFieldsConstraintValidator.php - - message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#" count: 1 @@ -1338,70 +1257,16 @@ parameters: count: 1 path: modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/field/tests/src/Functional/FormTest.php - - message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#" count: 2 path: modules/field/tests/src/Functional/NestedFormTest.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/field/tests/src/Functional/TranslationWebTest.php - - - - message: """ - #^Call to deprecated method deleteRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:deleteRevision instead\\.$# - """ - count: 1 - path: modules/field/tests/src/Kernel/FieldAttachStorageTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 4 - path: modules/field/tests/src/Kernel/FieldAttachStorageTest.php - - message: "#^Variable \\$values might not be defined\\.$#" count: 1 path: modules/field/tests/src/Kernel/FieldAttachStorageTest.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/field/tests/src/Kernel/FieldDataCountTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/field/tests/src/Kernel/KernelString/StringFormatterTest.php - - message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#" count: 1 @@ -1612,29 +1477,11 @@ parameters: count: 5 path: modules/jsonapi/src/Query/Filter.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/jsonapi/src/Revisions/NegotiatorBase.php - - message: "#^Method Drupal\\\\jsonapi\\\\Revisions\\\\VersionNegotiator\\:\\:getRevision\\(\\) should return Drupal\\\\Core\\\\Entity\\\\EntityInterface but return statement is missing\\.$#" count: 1 path: modules/jsonapi/src/Revisions/VersionNegotiator.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 2 - path: modules/jsonapi/tests/src/Functional/ResourceTestBase.php - - message: "#^Variable \\$created_entity might not be defined\\.$#" count: 1 @@ -1785,15 +1632,6 @@ parameters: count: 1 path: modules/media/src/OEmbed/UrlResolver.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/media_library/src/MediaLibraryFieldWidgetOpener.php - - message: "#^Variable \\$jpg_image might not be defined\\.$#" count: 1 @@ -1863,24 +1701,6 @@ parameters: count: 1 path: modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/migrate/src/Plugin/migrate/destination/EntityRevision.php - - message: "#^Method Drupal\\\\migrate\\\\Plugin\\\\migrate\\\\destination\\\\NullDestination\\:\\:import\\(\\) should return array\\|bool but return statement is missing\\.$#" count: 1 @@ -1896,15 +1716,6 @@ parameters: count: 2 path: modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 2 - path: modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php - - message: "#^Variable \\$sub_process_plugins might not be defined\\.$#" count: 2 @@ -2109,42 +1920,6 @@ parameters: count: 5 path: modules/node/tests/src/Functional/Views/Wizard/NodeRevisionWizardTest.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 2 - path: modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 2 - path: modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeRevisionTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 3 - path: modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 3 - path: modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeRevisionTest.php - - message: "#^Variable \\$changed in isset\\(\\) always exists and is not nullable\\.$#" count: 1 @@ -2753,15 +2528,6 @@ parameters: count: 1 path: modules/views/src/Plugin/views/field/Broken.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/views/src/Plugin/views/field/BulkForm.php - - message: "#^Variable \\$entity in empty\\(\\) always exists and is not falsy\\.$#" count: 1 @@ -2862,15 +2628,6 @@ parameters: count: 1 path: modules/views/src/Plugin/views/join/JoinPluginBase.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/views/src/Plugin/views/query/Sql.php - - message: "#^Variable \\$join in empty\\(\\) always exists and is not falsy\\.$#" count: 2 @@ -3101,15 +2858,6 @@ parameters: count: 1 path: modules/workspaces/src/Plugin/Validation/Constraint/DeletedWorkspaceConstraintValidator.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: modules/workspaces/src/Plugin/Validation/Constraint/EntityWorkspaceConflictConstraintValidator.php - - message: "#^Variable \\$entity in isset\\(\\) always exists and is not nullable\\.$#" count: 1 @@ -3196,51 +2944,6 @@ parameters: count: 1 path: tests/Drupal/FunctionalJavascriptTests/WebDriverCurlService.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 6 - path: tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 4 - path: tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: tests/Drupal/FunctionalTests/Entity/RevisionRouteProviderTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: tests/Drupal/FunctionalTests/Entity/RevisionViewTest.php - - message: "#^Variable \\$found might not be defined\\.$#" count: 1 @@ -3301,15 +3004,6 @@ parameters: count: 4 path: tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: tests/Drupal/KernelTests/Core/Entity/ContentEntityHasChangesTest.php - - message: "#^Variable \\$title might not be defined\\.$#" count: 2 @@ -3325,24 +3019,6 @@ parameters: count: 2 path: tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 2 - path: tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 3 - path: tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php - - message: "#^Variable \\$field might not be defined\\.$#" count: 9 @@ -3353,15 +3029,6 @@ parameters: count: 1 path: tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 1 - path: tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php - - message: "#^Variable \\$e might not be defined\\.$#" count: 1 @@ -3377,33 +3044,6 @@ parameters: count: 1 path: tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 2 - path: tests/Drupal/KernelTests/Core/Entity/RevisionRouteProviderTest.php - - - - message: """ - #^Call to deprecated method deleteRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:deleteRevision instead\\.$# - """ - count: 1 - path: tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php - - - - message: """ - #^Call to deprecated method loadRevision\\(\\) of class Drupal\\\\Core\\\\Entity\\\\EntityStorageInterface\\: - in drupal\\:10\\.1\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use - \\\\Drupal\\\\Core\\\\Entity\\\\RevisionableStorageInterface\\:\\:loadRevision instead\\.$# - """ - count: 2 - path: tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php - - message: "#^Variable \\$x might not be defined\\.$#" count: 1 diff --git a/core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php b/core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php index b956658c14be90eca43559a42be10ee0a6154324..7f06bae289b07ca53d4e0e96e7ea41447aaeedfc 100644 --- a/core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php +++ b/core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php @@ -51,6 +51,7 @@ protected function setUp(): void { * @dataProvider providerPageTitle */ public function testPageTitle(string $entityTypeId, string $expectedQuestion): void { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage($entityTypeId); $entity = $storage->create([ @@ -157,9 +158,10 @@ public function testAccessDeleteDefault(): void { $entity->save(); // Reload the entity. + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = \Drupal::entityTypeManager()->getStorage('entity_test_revpub'); /** @var \Drupal\entity_test\Entity\EntityTestRevPub $revision */ - $revision = \Drupal::entityTypeManager()->getStorage('entity_test_revpub') - ->loadRevision($revisionId); + $revision = $storage->loadRevision($revisionId); // Check default but not latest. $this->assertTrue($revision->isDefaultRevision()); $this->assertFalse($revision->isLatestRevision()); @@ -185,8 +187,9 @@ public function testAccessDeleteNonLatest(): void { $entity->save(); // Reload the entity. - $revision = \Drupal::entityTypeManager()->getStorage('entity_test_rev') - ->loadRevision($revisionId); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = \Drupal::entityTypeManager()->getStorage('entity_test_rev'); + $revision = $storage->loadRevision($revisionId); $this->drupalGet($revision->toUrl('revision-delete-form')); $this->assertSession()->statusCodeEquals(200); $this->assertTrue($revision->access('delete revision', $this->rootUser, FALSE)); @@ -218,6 +221,7 @@ public function testSubmitForm(array $permissions, string $entityTypeId, string if (count($permissions) > 0) { $this->drupalLogin($this->createUser($permissions)); } + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage($entityTypeId); $entity = $storage->create([ diff --git a/core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php b/core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php index 2c67d3ab4a984c7684d38bf459ec34950411bbd2..b0392e1d47f0bf4457e62b8729ab4d0002cae159 100644 --- a/core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php +++ b/core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php @@ -52,6 +52,7 @@ protected function setUp(): void { * @dataProvider providerPageTitle */ public function testPageTitle(string $entityTypeId, string $expectedQuestion): void { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage($entityTypeId); $entity = $storage->create([ @@ -150,8 +151,9 @@ public function testAccessRevertNonLatest(): void { $entity->save(); // Reload the entity. - $revision = \Drupal::entityTypeManager()->getStorage('entity_test_rev') - ->loadRevision($revisionId); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = \Drupal::entityTypeManager()->getStorage('entity_test_rev'); + $revision = $storage->loadRevision($revisionId); $this->drupalGet($revision->toUrl('revision-revert-form')); $this->assertSession()->statusCodeEquals(200); $this->assertTrue($revision->access('revert', $this->rootUser, FALSE)); @@ -181,6 +183,7 @@ public function testSubmitForm(array $permissions, string $entityTypeId, string if (count($permissions) > 0) { $this->drupalLogin($this->createUser($permissions)); } + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage($entityTypeId); $entity = $storage->create([ @@ -303,6 +306,7 @@ public function testPrepareRevision(): void { $count = $this->countRevisions($entity->getEntityTypeId()); // Load the revision to be copied. + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage($entity->getEntityTypeId()); /** @var \Drupal\entity_test_revlog\Entity\EntityTestWithRevisionLog $targetRevision */ $targetRevision = $storage->loadRevision($targetRevertRevisionId); diff --git a/core/tests/Drupal/FunctionalTests/Entity/RevisionRouteProviderTest.php b/core/tests/Drupal/FunctionalTests/Entity/RevisionRouteProviderTest.php index 56062dade42ec941ac8bb72e9b35e8b03ecf8b7c..5626c8f162352c013a7ae80f5a17b4a0655d57d5 100644 --- a/core/tests/Drupal/FunctionalTests/Entity/RevisionRouteProviderTest.php +++ b/core/tests/Drupal/FunctionalTests/Entity/RevisionRouteProviderTest.php @@ -54,7 +54,9 @@ public function testRevisionTitle(): void { $entity->save(); // Reload the object. - $revision = \Drupal::entityTypeManager()->getStorage('entity_test_rev')->loadRevision($revisionId); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = \Drupal::entityTypeManager()->getStorage('entity_test_rev'); + $revision = $storage->loadRevision($revisionId); $this->drupalGet($revision->toUrl('revision')); $this->assertSession()->responseContains('first revision'); $this->assertSession()->responseNotContains('second revision'); diff --git a/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php b/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php index f05a40abd0adeafbc0f5b817976540bcdc216332..b1d4f78db87600af1f62d24a6724dea8669bfff2 100644 --- a/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php +++ b/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php @@ -202,8 +202,9 @@ public function testDescriptionLinkWithAccess(): void { $row1Link = $this->assertSession()->elementExists('css', 'table tbody tr:nth-child(1) a'); $this->assertEquals($entity->toUrl()->toString(), $row1Link->getAttribute('href')); // Reload revision so object has the properties to build a revision link. - $firstRevision = \Drupal::entityTypeManager()->getStorage('entity_test_revlog') - ->loadRevision($firstRevisionId); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ + $storage = \Drupal::entityTypeManager()->getStorage('entity_test_revlog'); + $firstRevision = $storage->loadRevision($firstRevisionId); $row2Link = $this->assertSession()->elementExists('css', 'table tbody tr:nth-child(2) a'); $this->assertEquals($firstRevision->toUrl('revision')->toString(), $row2Link->getAttribute('href')); } diff --git a/core/tests/Drupal/FunctionalTests/Entity/RevisionViewTest.php b/core/tests/Drupal/FunctionalTests/Entity/RevisionViewTest.php index 52b34cdacb3bb3d0fff4c1ddb173105566420ed3..f728b6c95802243125192fec7b81c72db34fafc6 100644 --- a/core/tests/Drupal/FunctionalTests/Entity/RevisionViewTest.php +++ b/core/tests/Drupal/FunctionalTests/Entity/RevisionViewTest.php @@ -51,6 +51,7 @@ protected function setUp(): void { * @dataProvider providerRevisionPage */ public function testRevisionPage(string $entityTypeId, string $expectedPageTitle): void { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage($entityTypeId); // Add a field to test revision page output. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityHasChangesTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityHasChangesTest.php index cd29ff5a7dd88fd0f573ae9758b8801738180a9a..46aa060fc33242f2f61268fde36189fbe80ba6bf 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityHasChangesTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityHasChangesTest.php @@ -50,7 +50,7 @@ public function testHasTranslationChanges() { ]); $user2->save(); - /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */ + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->container->get('entity_type.manager') ->getStorage('entity_test_mulrev_changed_rev'); /** @var \Drupal\entity_test\Entity\EntityTestMulRevChangedWithRevisionLog $entity */ diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php index c582efc39bd17e914d9fe1dfd0319d122b0efa08..11c71b209562e884bb31fc1bebe551c5bfa34c2b 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php @@ -103,6 +103,7 @@ protected function createTestEntity($entity_type) { * Test setting field values on revisionable entities. */ public function testFieldEntityRevisionWrite() { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage('entity_test_rev'); // Create a new entity, with a field value 'foo'. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php index d3a5a5ccf8a022becf2b652764a2dd0404547619..ba8ffc5df1203b4bfb37b76e9494ff1626fab425 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php @@ -63,6 +63,7 @@ public function testNewRevisionAfterTranslation() { */ public function testRevertRevisionAfterTranslation() { $user = $this->createUser(); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage('entity_test_mulrev'); // Create a test entity. @@ -98,6 +99,7 @@ public function testRevertRevisionAfterTranslation() { */ public function testTranslationValuesWhenSavingPendingRevisions() { $user = $this->createUser(); + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage('entity_test_mulrev'); // Create a test entity and a translation for it. diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php index 3c938e5db30af8e3e2501c11f06c52115ac56649..1b15ca5cba27c388a3967f1f9be0fabaa02adab9 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php @@ -107,6 +107,7 @@ protected function setUp(): void { */ public function testFieldLoad() { $entity_type = $bundle = 'entity_test_rev'; + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->container->get('entity_type.manager')->getStorage($entity_type); $columns = ['bundle', 'deleted', 'entity_id', 'revision_id', 'delta', 'langcode', $this->tableMapping->getFieldColumnName($this->fieldStorage, 'value')]; diff --git a/core/tests/Drupal/KernelTests/Core/Entity/RevisionRouteProviderTest.php b/core/tests/Drupal/KernelTests/Core/Entity/RevisionRouteProviderTest.php index bdde7ca46adb2072d834cbfaa46ed5a695c888ff..59cd473b6c4810359ddb230e011a0b0c73e7c12f 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/RevisionRouteProviderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/RevisionRouteProviderTest.php @@ -66,6 +66,7 @@ public function testOperationAccessOverview(): void { * @dataProvider providerOperationAccessRevisionRoutes */ public function testOperationAccessRevisionRoutes(string $linkTemplate, string $entityLabel): void { + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $entityStorage */ $entityStorage = \Drupal::entityTypeManager()->getStorage('entity_test_rev'); $entity = EntityTestRev::create() diff --git a/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php index 15d56e68d604b009873ded5795d9f5e9ac3051b8..b0ce3373d0b0d3a6818e7c771752ef0ca6b76e9d 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php @@ -59,6 +59,7 @@ public function testRevisionableContentEntity() { $revision_id = $entity->getRevisionId(); $revision_ids[] = $revision_id; + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage('entity_test_mul_revlog'); $entity = $storage->loadRevision($revision_id); $this->assertEquals($random_timestamp, $entity->getRevisionCreationTime()); @@ -135,6 +136,7 @@ public function testWasDefaultRevision() { $this->assertFalse($entity->wasDefaultRevision()); // Check that the default revision status was stored correctly. + /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = $this->entityTypeManager->getStorage($entity_type_id); foreach ([TRUE, FALSE, TRUE, FALSE] as $index => $expected) { /** @var \Drupal\entity_test_revlog\Entity\EntityTestMulWithRevisionLog $revision */