chore: Проверки для типов

This commit is contained in:
origami11@yandex.ru 2025-12-01 16:19:28 +03:00
parent 6fdc3eb46b
commit 5d3fae4249
15 changed files with 125 additions and 42 deletions

View file

@ -144,7 +144,7 @@ class Drawing
$temp_x = $x;
for ($i = 0; $i < mb_strlen($text); $i++) {
$bbox = imagettftext($image, $size, $angle, $temp_x, $y, $color, $font, $text[$i]);
$temp_x += $spacing + ($bbox[2] - $bbox[0]);
$temp_x += $spacing + ($bbox !== false ? ($bbox[2] - $bbox[0]) : 0);
}
}
}

View file

@ -25,8 +25,11 @@ class Image
{
$width = imagesx($image);
$height = imagesy($image);
$percent = min($prewidth / $width, $preheight / $height);
if ($percent > 1 && !$force) $percent = 1;
if ($percent > 1 && !$force) {
$percent = 1;
}
$new_width = $width * $percent;
$new_height = $height * $percent;

View file

@ -89,8 +89,8 @@ class TemplateImage
/**
* Создает пустое изображение
* @param int $width
* @param int $height
* @param int<1, max> $width
* @param int<1, max> $height
*/
function setEmptyImage($width, $height): void
{