fix: phpstan level=6
This commit is contained in:
parent
acbf2c847d
commit
48269bd424
41 changed files with 324 additions and 347 deletions
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
namespace ctiso\Tools;
|
||||
|
||||
use GdImage;
|
||||
|
||||
class Image
|
||||
{
|
||||
static function load($uri)
|
||||
{
|
||||
static function load($uri): GdImage|false
|
||||
{
|
||||
$e = strtolower(pathinfo($uri, PATHINFO_EXTENSION));
|
||||
switch ($e) {
|
||||
|
|
@ -12,9 +14,10 @@ class Image
|
|||
case 'jpeg': case 'jpg': return imagecreatefromjpeg($uri);
|
||||
case 'gif': return imagecreatefromgif($uri);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static function fit($image, $prewidth, $preheight, $force = true)
|
||||
static function fit(GdImage $image, int $prewidth, int $preheight, bool $force = true): GdImage|false
|
||||
{
|
||||
$width = imagesx($image);
|
||||
$height = imagesy($image);
|
||||
|
|
@ -29,7 +32,7 @@ class Image
|
|||
return $image_p;
|
||||
}
|
||||
|
||||
static function save($image, $uri)
|
||||
static function save($image, $uri): bool
|
||||
{
|
||||
$e = strtolower(pathinfo($uri, PATHINFO_EXTENSION));
|
||||
switch ($e) {
|
||||
|
|
@ -37,5 +40,6 @@ class Image
|
|||
case 'png': imagepng($image, $uri); break;
|
||||
case 'gif': imagegif($image, $uri); break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue