Qual: Fix nullable and typing (phan notices)

This commit is contained in:
MDW 2025-01-05 16:53:07 +01:00
parent a35d502409
commit f64c0818f9
No known key found for this signature in database

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -315,6 +315,10 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
break;
}
if ($img === null) {
return "Error: Could not create Image from '$filetoread'";
}
// Create empty image for target
if ($newExt == 'gif') {
// Compatibility image GIF
@ -615,6 +619,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
// Variable initialization according to image extension
$img = null;
$extImg = null;
switch ($infoImg[2]) {
case IMAGETYPE_GIF: // 1
$img = imagecreatefromgif($filetoread);
@ -805,7 +810,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
imagejpeg($imgThumb, $imgThumbName, $newquality); // @phan-suppress-current-line PhanTypeMismatchArgumentNullableInternal,PhanPossiblyUndeclaredVariable
break;
case IMAGETYPE_PNG: // 3
imagepng($imgThumb, $imgThumbName, $newquality); // @phan-suppress-current-line PhanPossiblyUndeclaredVariable
imagepng($imgThumb, $imgThumbName, !is_numeric($newquality) ? -1 : (int) $newquality); // @phan-suppress-current-line PhanPossiblyUndeclaredVariable
break;
case IMAGETYPE_BMP: // 6
// Not supported by PHP GD