1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-17 04:08:14 +01:00

Declare strict types project wide

This commit is contained in:
Oliver Vogel 2024-01-16 12:01:29 +01:00
parent 93885988e1
commit 86ab920897
458 changed files with 954 additions and 35 deletions

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Analyzers;
class ColorspaceAnalyzer extends SpecializableAnalyzer

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Analyzers;
class HeightAnalyzer extends SpecializableAnalyzer

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Analyzers;
class PixelColorAnalyzer extends SpecializableAnalyzer

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Analyzers;
class PixelColorsAnalyzer extends SpecializableAnalyzer

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Analyzers;
class ProfileAnalyzer extends SpecializableAnalyzer

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Analyzers;
class ResolutionAnalyzer extends SpecializableAnalyzer

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Analyzers;
use Intervention\Image\Interfaces\AnalyzerInterface;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Analyzers;
class WidthAnalyzer extends SpecializableAnalyzer

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image;
use Intervention\Image\Exceptions\RuntimeException;
@ -136,7 +138,7 @@ class Collection implements CollectionInterface, IteratorAggregate, Countable
return array_key_exists($query, $this->items) ? $this->items[$query] : $default;
}
$query = explode('.', $query);
$query = explode('.', (string) $query);
$result = $default;
$items = $this->items;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors;
use Intervention\Image\Exceptions\ColorException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors;
use Intervention\Image\Exceptions\ColorException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Cmyk\Channels;
use Intervention\Image\Colors\AbstractColorChannel;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Cmyk\Channels;
class Key extends Cyan

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Cmyk\Channels;
class Magenta extends Cyan

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Cmyk\Channels;
class Yellow extends Cyan

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Cmyk;
use Intervention\Image\Colors\AbstractColor;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Cmyk;
use Intervention\Image\Colors\Rgb\Color as RgbColor;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Cmyk\Decoders;
use Intervention\Image\Colors\Cmyk\Color;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsl\Channels;
use Intervention\Image\Colors\AbstractColorChannel;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsl\Channels;
use Intervention\Image\Colors\AbstractColorChannel;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsl\Channels;
use Intervention\Image\Colors\AbstractColorChannel;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsl;
use Intervention\Image\Colors\AbstractColor;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsl;
use Intervention\Image\Colors\Cmyk\Color as CmykColor;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsl\Decoders;
use Intervention\Image\Colors\Hsl\Color;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsv\Channels;
use Intervention\Image\Colors\AbstractColorChannel;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsv\Channels;
use Intervention\Image\Colors\AbstractColorChannel;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsv\Channels;
use Intervention\Image\Colors\AbstractColorChannel;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsv;
use Intervention\Image\Colors\AbstractColor;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsv;
use Intervention\Image\Colors\Cmyk\Color as CmykColor;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Hsv\Decoders;
use Intervention\Image\Colors\Hsv\Color;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors;
use Intervention\Image\File;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Rgb\Channels;
class Alpha extends Red

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Rgb\Channels;
class Blue extends Red

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Rgb\Channels;
class Green extends Red

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Rgb\Channels;
use Intervention\Image\Colors\AbstractColorChannel;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Rgb;
use Intervention\Image\Colors\AbstractColor;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Rgb;
use Intervention\Image\Colors\Hsv\Color as HsvColor;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Rgb\Decoders;
use Intervention\Image\Colors\Rgb\Color;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Rgb\Decoders;
use Intervention\Image\Exceptions\DecoderException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Rgb\Decoders;
use Intervention\Image\Colors\Rgb\Color;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Colors\Rgb\Decoders;
use Intervention\Image\Exceptions\DecoderException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Decoders;
class Base64ImageDecoder extends SpecializableDecoder

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Decoders;
class BinaryImageDecoder extends SpecializableDecoder

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Decoders;
class DataUriImageDecoder extends SpecializableDecoder

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Decoders;
class FilePathImageDecoder extends SpecializableDecoder

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Decoders;
class FilePointerImageDecoder extends SpecializableDecoder

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Decoders;
class ImageObjectDecoder extends SpecializableDecoder

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Decoders;
use Intervention\Image\Exceptions\DecoderException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Decoders;
class SplFileInfoImageDecoder extends SpecializableDecoder

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers;
use Exception;
@ -59,7 +61,7 @@ abstract class AbstractDecoder extends DriverSpecialized implements DecoderInter
*/
protected function isGifFormat(string $input): bool
{
return preg_match(
return 1 === preg_match(
"/^47494638(37|39)61/",
strtoupper(substr(bin2hex($input), 0, 32))
);

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers;
use Intervention\Image\Exceptions\DecoderException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers;
use Intervention\Image\Exceptions\NotSupportedException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers;
use Intervention\Image\Drivers\AbstractDecoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers;
use Intervention\Image\Geometry\Point;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers;
use Intervention\Image\Interfaces\DriverInterface;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers;
use Intervention\Image\Interfaces\EncoderInterface;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use Intervention\Image\Colors\Rgb\Colorspace;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use GdImage;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use Intervention\Image\Collection;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd;
use GdImage;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd;
use Intervention\Image\Colors\Rgb\Channels\Alpha;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd;
use Intervention\Image\Collection;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Decoders;
use Intervention\Image\Exceptions\DecoderException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Decoders;
use Intervention\Image\Drivers\AbstractDecoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Decoders;
use Intervention\Image\Drivers\AbstractDecoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Decoders;
use Intervention\Image\Exceptions\DecoderException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Decoders;
use Exception;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Decoders;
use Intervention\Image\Exceptions\DecoderException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Decoders;
use Intervention\Image\Drivers\AbstractDecoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Decoders;
use SplFileInfo;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd;
use Intervention\Image\Drivers\AbstractDriver;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Encoders;
use Intervention\Gif\Builder as GifBuilder;
@ -32,7 +34,7 @@ class GifEncoder extends DriverSpecializedEncoder
foreach ($image as $frame) {
$builder->addFrame(
$this->encode($frame->toImage($image->driver())),
(string) $this->encode($frame->toImage($image->driver())),
$frame->delay()
);
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd;
use GdImage;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd;
use Intervention\Image\Colors\Rgb\Decoders\HexColorDecoder as RgbHexColorDecoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
@ -16,9 +18,9 @@ class ColorizeModifier extends DriverSpecialized implements ModifierInterface
public function apply(ImageInterface $image): ImageInterface
{
// normalize colorize levels
$red = round($this->red * 2.55);
$green = round($this->green * 2.55);
$blue = round($this->blue * 2.55);
$red = (int) round($this->red * 2.55);
$green = (int) round($this->green * 2.55);
$blue = (int) round($this->blue * 2.55);
foreach ($image as $frame) {
imagefilter($frame->native(), IMG_FILTER_COLORIZE, $red, $green, $blue);

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Colors\Rgb\Colorspace as RgbColorspace;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Colors\Rgb\Channels\Blue;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Interfaces\SizeInterface;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\AbstractDrawModifier;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\AbstractDrawModifier;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\AbstractDrawModifier;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\AbstractDrawModifier;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;

Some files were not shown because too many files have changed in this diff Show More