From 58d465d74aa3a34947968ef8766afb2ed2170de7 Mon Sep 17 00:00:00 2001 From: Andreas Hennings Date: Thu, 7 Nov 2024 16:50:23 +0100 Subject: [PATCH] Issue #43: Add inline `@var` doc for static analysis. --- src/Cool/CoolUtils.php | 1 + src/Plugin/Field/FieldFormatter/CoolPreview.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Cool/CoolUtils.php b/src/Cool/CoolUtils.php index d119f4cb..a4951591 100644 --- a/src/Cool/CoolUtils.php +++ b/src/Cool/CoolUtils.php @@ -29,6 +29,7 @@ public static function getFile(Media $media) { /** Get the file based on the entity id */ public static function getFileById($id) { + /** @var \Drupal\media\MediaInterface|null $media */ $media = \Drupal::entityTypeManager()->getStorage('media')->load($id); return CoolUtils::getFile($media); } diff --git a/src/Plugin/Field/FieldFormatter/CoolPreview.php b/src/Plugin/Field/FieldFormatter/CoolPreview.php index 52768b42..3cadd370 100644 --- a/src/Plugin/Field/FieldFormatter/CoolPreview.php +++ b/src/Plugin/Field/FieldFormatter/CoolPreview.php @@ -43,6 +43,7 @@ public function settingsSummary() { * {@inheritdoc} */ public function viewElements(FieldItemListInterface $items, $langcode) { + /** @var \Drupal\Core\Field\EntityReferenceFieldItemListInterface $items */ $elements = []; $media = $items->getEntity(); if (!$media instanceof MediaInterface) {