Skip to content

Commit

Permalink
chore: phpstan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 committed Jul 7, 2024
1 parent 1feefc0 commit 3db222a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions EMS/common-bundle/src/Storage/Processor/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public function generate(string $filename, string $cacheFilename = null): string
if (false === $length) {
throw new \RuntimeException('Could not read file');
}
if (0 === $length) {
return '';
}

$handle = \fopen($filename, 'r');
if (false === $handle) {
Expand Down
6 changes: 3 additions & 3 deletions EMS/common-bundle/src/Twig/AssetRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ public function assetAverageColor(string $hash): string
throw new \RuntimeException('Unexpected imagecolorat error');
}
$rgb = \imagecolorsforindex($image, $index);
$red = \round(\round(($rgb['red'] ?? 255) / 0x33) * 0x33);
$green = \round(\round(($rgb['green'] ?? 255) / 0x33) * 0x33);
$blue = \round(\round(($rgb['blue'] ?? 255) / 0x33) * 0x33);
$red = \round(\round($rgb['red'] / 0x33) * 0x33);
$green = \round(\round($rgb['green'] / 0x33) * 0x33);
$blue = \round(\round($rgb['blue'] / 0x33) * 0x33);

return \sprintf('#%02X%02X%02X', $red, $green, $blue);
} catch (\Throwable) {
Expand Down

0 comments on commit 3db222a

Please sign in to comment.