Skip to content

Commit 80d981e

Browse files
authored
Merge pull request #141 from guisaldanha/master
Fix in convertHexToRGB method. PHP 8.1 does not allow the input strin…
2 parents b0d4b73 + 0558ed1 commit 80d981e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Core/ImageWorkshopLib.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ public static function calculatePositions($containerWidth, $containerHeight, $la
7070
/**
7171
* Convert Hex color to RGB color format
7272
*
73-
* @param string $hex
73+
* @param string|null $hex
7474
*
7575
* @return array
7676
*/
7777
public static function convertHexToRGB($hex)
7878
{
7979
return array(
80-
'R' => (int) base_convert(substr($hex, 0, 2), 16, 10),
81-
'G' => (int) base_convert(substr($hex, 2, 2), 16, 10),
82-
'B' => (int) base_convert(substr($hex, 4, 2), 16, 10),
80+
'R' => (int) base_convert(substr($hex ?? '', 0, 2), 16, 10),
81+
'G' => (int) base_convert(substr($hex ?? '', 2, 2), 16, 10),
82+
'B' => (int) base_convert(substr($hex ?? '', 4, 2), 16, 10),
8383
);
8484
}
8585

0 commit comments

Comments
 (0)