Skip to content

Commit

Permalink
Image: Fix compatibility with PhpStan.
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek authored Sep 26, 2022
1 parent 4b8ab29 commit d6c5f7e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ private function findSimilarImageBySameHash(): void
{
$md5CacheFile = md5_file($this->cachePath);
$pathInfo = pathinfo($this->cachePath);
assert(isset($pathInfo['dirname']));
$pathInfoList = scandir($pathInfo['dirname'], 1);
foreach (is_array($pathInfoList) ? $pathInfoList : [] as $item) {
if (
Expand All @@ -259,14 +260,14 @@ private function findSimilarImageBySameHash(): void
&& $parser['md5'] === $md5CacheFile
) {
unlink($this->cachePath);
$this->canonicalPath = $pathInfo['dirname'] . '/' . $parser['filename'];
$this->canonicalPath = sprintf('%s/%s', $pathInfo['dirname'], $parser['filename']);
symlink(basename($this->canonicalPath), $this->cachePath);

return;
}
}

FileSystem::write($this->cachePath . '_' . $md5CacheFile . '.md5', '');
FileSystem::write(sprintf('%s_%s.md5', $this->cachePath, $md5CacheFile), '');
}


Expand Down

0 comments on commit d6c5f7e

Please sign in to comment.