Issue #3383513 by Spokje, smustgrave: Use type-hinting on deprecation warnings for loadRevision() introduced by mglaman/phpstan-drupal:1.2.0

merge-requests/4631/head
catch 2023-08-29 13:03:05 +01:00
parent cb606a0cc1
commit cc0c9fdde2
39 changed files with 119 additions and 406 deletions

View File

@ -100,9 +100,10 @@ class EntityUntranslatableFieldsConstraintValidator extends ConstraintValidator
$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) {

View File

@ -61,7 +61,9 @@ class EntityRevisionParamConverter implements ParamConverterInterface {
*/
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.

View File

@ -161,8 +161,10 @@ class ContentModerationState extends ContentEntityBase implements ContentModerat
* {@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);

View File

@ -120,7 +120,7 @@ class ModerationInformation implements ModerationInformationInterface {
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 @@ class ModerationInformation implements ModerationInformationInterface {
$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 @@ class ModerationInformation implements ModerationInformationInterface {
* 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()));

View File

@ -125,8 +125,10 @@ class ModerationStateWidget extends OptionsSelectWidget {
// 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());
}

View File

@ -150,6 +150,7 @@ class ContentModerationStateTest extends KernelTestBase {
$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 @@ class ContentModerationStateTest extends KernelTestBase {
* 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) {

View File

@ -115,6 +115,7 @@ class ContentModerationSyncingTest extends KernelTestBase {
* 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 @@ class ContentModerationSyncingTest extends KernelTestBase {
* 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 @@ class ContentModerationSyncingTest extends KernelTestBase {
* 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;

View File

@ -190,6 +190,7 @@ class FieldTranslationSynchronizer implements FieldTranslationSynchronizerInterf
*/
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());
}

View File

@ -170,6 +170,7 @@ class ContentTranslationSynchronizedFieldsConstraintValidator extends Constraint
*/
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());
}

View File

@ -578,9 +578,10 @@ class FormTest extends FieldTestBase {
$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.');
}

View File

@ -139,9 +139,10 @@ class TranslationWebTest extends FieldTestBase {
*/
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()]));

View File

@ -50,6 +50,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
$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 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
$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();

View File

@ -136,6 +136,7 @@ class FieldDataCountTest extends FieldKernelTestBase {
$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]));

View File

@ -163,7 +163,9 @@ class StringFormatterTest extends KernelTestBase {
$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);

View File

@ -75,6 +75,7 @@ abstract class NegotiatorBase implements VersionNegotiatorInterface {
* 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()) {

View File

@ -3129,9 +3129,14 @@ abstract class ResourceTestBase extends BrowserTestBase {
[$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 @@ abstract class ResourceTestBase extends BrowserTestBase {
[$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);

View File

@ -60,6 +60,7 @@ class MediaLibraryFieldWidgetOpener implements MediaLibraryOpenerInterface {
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);

View File

@ -59,10 +59,15 @@ class EntityContentComplete extends EntityContentBase {
: $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 @@ class EntityContentComplete extends EntityContentBase {
// 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);

View File

@ -137,10 +137,15 @@ class EntityRevision extends EntityContentBase {
$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);

View File

@ -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 @@ class EntityRevisionTest extends UnitTestCase {
// 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');

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -551,7 +551,13 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
// 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);

View File

@ -1633,6 +1633,7 @@ class Sql extends QueryPluginBase {
// 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 = [];

View File

@ -86,6 +86,7 @@ class EntityWorkspaceConflictConstraintValidator extends ConstraintValidator imp
// 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()));
});

View File

@ -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

View File

@ -51,6 +51,7 @@ class RevisionDeleteFormTest extends BrowserTestBase {
* @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 @@ class RevisionDeleteFormTest extends BrowserTestBase {
$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 @@ class RevisionDeleteFormTest extends BrowserTestBase {
$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 @@ class RevisionDeleteFormTest extends BrowserTestBase {
if (count($permissions) > 0) {
$this->drupalLogin($this->createUser($permissions));
}
/** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */
$storage = \Drupal::entityTypeManager()->getStorage($entityTypeId);
$entity = $storage->create([

View File

@ -52,6 +52,7 @@ class RevisionRevertFormTest extends BrowserTestBase {
* @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 @@ class RevisionRevertFormTest extends BrowserTestBase {
$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 @@ class RevisionRevertFormTest extends BrowserTestBase {
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 @@ class RevisionRevertFormTest extends BrowserTestBase {
$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);

View File

@ -54,7 +54,9 @@ class RevisionRouteProviderTest extends BrowserTestBase {
$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');

View File

@ -202,8 +202,9 @@ class RevisionVersionHistoryTest extends BrowserTestBase {
$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'));
}

View File

@ -51,6 +51,7 @@ class RevisionViewTest extends BrowserTestBase {
* @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.

View File

@ -50,7 +50,7 @@ class ContentEntityHasChangesTest extends KernelTestBase {
]);
$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 */

View File

@ -103,6 +103,7 @@ class EntityFieldTest extends EntityKernelTestBase {
* 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'.

View File

@ -63,6 +63,7 @@ class EntityRevisionTranslationTest extends EntityKernelTestBase {
*/
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 @@ class EntityRevisionTranslationTest extends EntityKernelTestBase {
*/
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.

View File

@ -107,6 +107,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase {
*/
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')];

View File

@ -66,6 +66,7 @@ class RevisionRouteProviderTest extends KernelTestBase {
* @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()

View File

@ -59,6 +59,7 @@ class RevisionableContentEntityBaseTest extends EntityKernelTestBase {
$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 @@ class RevisionableContentEntityBaseTest extends EntityKernelTestBase {
$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 */