Skip to content
Snippets Groups Projects
Commit 901e4be3 authored by Adrian Lorenc's avatar Adrian Lorenc
Browse files

ISAICP-9432: Fix falling phpstan issues.

parent 76710cae
No related branches found
No related tags found
2 merge requests!214ISAICP-9579: Fix SearchWidget: refer own submit callbacks precisely to prevent...,!212Release 2.3.0
......@@ -10,6 +10,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Entity\RevisionableStorageInterface;
use Drupal\Core\Entity\RevisionLogInterface;
use Drupal\Core\Entity\RevisionableInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
......@@ -204,6 +205,7 @@ public function unarchiveEntity(
return $entity;
}
$entityStorage = $this->entityTypeManager->getStorage($entityType->id());
assert($entityStorage instanceof RevisionableStorageInterface);
// Load the previous published revision's IDs.
$revisionIdsQuery = $entityStorage->getQuery()
......
......@@ -7,6 +7,7 @@
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\RevisionableStorageInterface;
use Drupal\Core\TypedData\TranslatableInterface;
/**
......@@ -83,8 +84,11 @@ public function loadDefaultRevision(ContentEntityInterface $entity): ?ContentEnt
*/
public function loadLatestRevision(ContentEntityInterface $entity): ?ContentEntityInterface {
if ($latest_revision_id = $this->getLatestRevisionId($entity)) {
/** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */
$storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId());
assert($storage instanceof RevisionableStorageInterface);
/** @var \Drupal\Core\Entity\ContentEntityInterface|NULL $revision */
$revision = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->loadRevision($latest_revision_id);
$revision = $storage->loadRevision($latest_revision_id);
return $revision;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment