From 4b3098bf53c94225a2d8d97fed67d758160080c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bar=C3=A1=C5=A1ek?= Date: Fri, 11 Feb 2022 22:39:35 +0100 Subject: [PATCH] ImageRequest: Fix PhpStan. --- src/Entity/ImageRequest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Entity/ImageRequest.php b/src/Entity/ImageRequest.php index 5ca739a..d603df0 100644 --- a/src/Entity/ImageRequest.php +++ b/src/Entity/ImageRequest.php @@ -107,15 +107,16 @@ public function getSourceFileAbsolutePath(): ?string $return = null; if (is_dir($absoluteFileDirPath) === true) { foreach ((new \DirectoryIterator($absoluteFileDirPath)) as $item) { - assert($item instanceof \DirectoryIterator); if (in_array($item->getFilename(), ['.', '..'], true)) { continue; } + $realPath = $item->getRealPath(); + assert(is_string($realPath)); if ( ($return === null || $item->getExtension() === $this->extension) - && pathinfo($item->getRealPath())['filename'] === $this->basename + && pathinfo($realPath)['filename'] === $this->basename ) { - $return = $item->getRealPath(); + $return = $realPath; } } }