From c616f122fea34ab4e9ccad2354217c345a888e28 Mon Sep 17 00:00:00 2001 From: Marco Perberschlager Date: Thu, 24 Oct 2024 10:38:30 +0200 Subject: [PATCH] Fix phpstan/sonar --- src/GraphQL/FieldHelper/AssetFieldHelper.php | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/GraphQL/FieldHelper/AssetFieldHelper.php b/src/GraphQL/FieldHelper/AssetFieldHelper.php index 932e3224..4169859d 100644 --- a/src/GraphQL/FieldHelper/AssetFieldHelper.php +++ b/src/GraphQL/FieldHelper/AssetFieldHelper.php @@ -47,15 +47,19 @@ public function getImageDocumentThumbnail( string $thumbNailFormat = null, bool $deferred = false ): mixed { - match(true) { - $asset instanceof Asset\Document => $thumb = $asset->getImageThumbnail( - $thumbNailConfig, - deferred: $deferred - ), - $asset instanceof Asset\Video => $thumb = $asset->getImageThumbnail($thumbNailConfig), - $asset instanceof Asset\Image => $thumb = $asset->getThumbnail($thumbNailConfig, $deferred), - default => $thumb = null - }; + $thumb = null; + + if($asset instanceof Asset\Document) { + $thumb = $asset->getImageThumbnail($thumbNailConfig, deferred: $deferred); + } + + if($asset instanceof Asset\Video) { + $thumb = $asset->getImageThumbnail($thumbNailConfig); + } + + if($asset instanceof Asset\Image) { + $thumb = $asset->getThumbnail($thumbNailConfig, $deferred); + } if ( !($asset instanceof Asset\Video) &&