1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-21 05:01:20 +02:00

Add type hints on various variables

This commit is contained in:
Oliver Vogel
2024-05-01 19:21:42 +02:00
parent 8e00dd330f
commit 55b5208d76
9 changed files with 11 additions and 11 deletions

View File

@@ -52,7 +52,7 @@ abstract class AbstractColorChannel implements ColorChannelInterface
* *
* @see ColorChannelInterface::normalize() * @see ColorChannelInterface::normalize()
*/ */
public function normalize($precision = 32): float public function normalize(int $precision = 32): float
{ {
return round(($this->value() - $this->min()) / ($this->max() - $this->min()), $precision); return round(($this->value() - $this->min()) / ($this->max() - $this->min()), $precision);
} }

View File

@@ -15,7 +15,7 @@ use Intervention\Image\Interfaces\ColorspaceInterface;
class Colorspace implements ColorspaceInterface class Colorspace implements ColorspaceInterface
{ {
public static $channels = [ public static array $channels = [
Channels\Cyan::class, Channels\Cyan::class,
Channels\Magenta::class, Channels\Magenta::class,
Channels\Yellow::class, Channels\Yellow::class,

View File

@@ -14,7 +14,7 @@ use Intervention\Image\Interfaces\ColorspaceInterface;
class Colorspace implements ColorspaceInterface class Colorspace implements ColorspaceInterface
{ {
public static $channels = [ public static array $channels = [
Channels\Hue::class, Channels\Hue::class,
Channels\Saturation::class, Channels\Saturation::class,
Channels\Luminance::class Channels\Luminance::class

View File

@@ -14,7 +14,7 @@ use Intervention\Image\Interfaces\ColorspaceInterface;
class Colorspace implements ColorspaceInterface class Colorspace implements ColorspaceInterface
{ {
public static $channels = [ public static array $channels = [
Channels\Hue::class, Channels\Hue::class,
Channels\Saturation::class, Channels\Saturation::class,
Channels\Value::class Channels\Value::class

View File

@@ -13,7 +13,7 @@ use Intervention\Image\Interfaces\ColorspaceInterface;
class Colorspace implements ColorspaceInterface class Colorspace implements ColorspaceInterface
{ {
public static $channels = [ public static array $channels = [
Channels\Red::class, Channels\Red::class,
Channels\Green::class, Channels\Green::class,
Channels\Blue::class, Channels\Blue::class,

View File

@@ -11,7 +11,7 @@ use Intervention\Image\Interfaces\ImageInterface;
class HtmlColornameDecoder extends HexColorDecoder implements DecoderInterface class HtmlColornameDecoder extends HexColorDecoder implements DecoderInterface
{ {
protected static $names = [ protected static array $names = [
'lightsalmon' => '#ffa07a', 'lightsalmon' => '#ffa07a',
'salmon' => '#fa8072', 'salmon' => '#fa8072',
'darksalmon' => '#e9967a', 'darksalmon' => '#e9967a',

View File

@@ -156,10 +156,10 @@ abstract class AbstractDecoder implements DecoderInterface
return new class ($matches, $result) return new class ($matches, $result)
{ {
private $matches; private array $matches;
private $result; private int|false $result;
public function __construct($matches, $result) public function __construct(array $matches, int|false $result)
{ {
$this->matches = $matches; $this->matches = $matches;
$this->result = $result; $this->result = $result;

View File

@@ -15,7 +15,7 @@ use Intervention\Image\Modifiers\ColorspaceModifier as GenericColorspaceModifier
class ColorspaceModifier extends GenericColorspaceModifier implements SpecializedInterface class ColorspaceModifier extends GenericColorspaceModifier implements SpecializedInterface
{ {
protected static $mapping = [ protected static array $mapping = [
RgbColorspace::class => Imagick::COLORSPACE_SRGB, RgbColorspace::class => Imagick::COLORSPACE_SRGB,
CmykColorspace::class => Imagick::COLORSPACE_CMYK, CmykColorspace::class => Imagick::COLORSPACE_CMYK,
]; ];

View File

@@ -33,7 +33,7 @@ class RectangleResizer
/** /**
* @throws GeometryException * @throws GeometryException
*/ */
public static function to(...$arguments): self public static function to(mixed ...$arguments): self
{ {
return new self(...$arguments); return new self(...$arguments);
} }