diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7b70482..fb76963 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['8.2', '8.3', '8.4'] + php-versions: ['8.3', '8.4', '8.5'] fail-fast: false steps: - uses: actions/checkout@v4 diff --git a/composer.json b/composer.json index 03a54d6..b723b49 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^8.2", + "php": "^8.3", "bacon/bacon-qr-code": "^3.0" }, "require-dev": { diff --git a/src/Writer/AbstractGdWriter.php b/src/Writer/AbstractGdWriter.php index 5411c05..58f26dd 100644 --- a/src/Writer/AbstractGdWriter.php +++ b/src/Writer/AbstractGdWriter.php @@ -27,6 +27,7 @@ protected function getMatrix(QrCodeInterface $qrCode): MatrixInterface return $matrixFactory->create($qrCode); } + #[\Override] public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, array $options = []): ResultInterface { if (!extension_loaded('gd')) { @@ -195,6 +196,7 @@ private function addLabel(LabelInterface $label, GdResult $result): GdResult return new GdResult($result->getMatrix(), $targetImage); } + #[\Override] public function validateResult(ResultInterface $result, string $expectedData): void { $string = $result->getString(); diff --git a/src/Writer/BinaryWriter.php b/src/Writer/BinaryWriter.php index 8e0c7e8..55cf72a 100644 --- a/src/Writer/BinaryWriter.php +++ b/src/Writer/BinaryWriter.php @@ -13,6 +13,7 @@ final readonly class BinaryWriter implements WriterInterface { + #[\Override] public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, array $options = []): ResultInterface { $matrixFactory = new MatrixFactory(); diff --git a/src/Writer/ConsoleWriter.php b/src/Writer/ConsoleWriter.php index e3bb7c3..74449ae 100644 --- a/src/Writer/ConsoleWriter.php +++ b/src/Writer/ConsoleWriter.php @@ -13,6 +13,7 @@ final readonly class ConsoleWriter implements WriterInterface { + #[\Override] public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, $options = []): ResultInterface { $matrixFactory = new MatrixFactory(); diff --git a/src/Writer/DebugWriter.php b/src/Writer/DebugWriter.php index 8910a80..5b505d9 100644 --- a/src/Writer/DebugWriter.php +++ b/src/Writer/DebugWriter.php @@ -13,6 +13,7 @@ final readonly class DebugWriter implements WriterInterface, ValidatingWriterInterface { + #[\Override] public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, array $options = []): ResultInterface { $matrixFactory = new MatrixFactory(); @@ -21,6 +22,7 @@ public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?Lab return new DebugResult($matrix, $qrCode, $logo, $label, $options); } + #[\Override] public function validateResult(ResultInterface $result, string $expectedData): void { if (!$result instanceof DebugResult) { diff --git a/src/Writer/EpsWriter.php b/src/Writer/EpsWriter.php index 2f41967..b135928 100644 --- a/src/Writer/EpsWriter.php +++ b/src/Writer/EpsWriter.php @@ -13,8 +13,9 @@ final readonly class EpsWriter implements WriterInterface { - public const DECIMAL_PRECISION = 10; + public const int DECIMAL_PRECISION = 10; + #[\Override] public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, array $options = []): ResultInterface { $matrixFactory = new MatrixFactory(); diff --git a/src/Writer/GifWriter.php b/src/Writer/GifWriter.php index 031e02c..a27644f 100644 --- a/src/Writer/GifWriter.php +++ b/src/Writer/GifWriter.php @@ -13,6 +13,7 @@ final readonly class GifWriter extends AbstractGdWriter { + #[\Override] public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, array $options = []): ResultInterface { /** @var GdResult $gdResult */ diff --git a/src/Writer/PdfWriter.php b/src/Writer/PdfWriter.php index 3f0cd73..6658c9c 100644 --- a/src/Writer/PdfWriter.php +++ b/src/Writer/PdfWriter.php @@ -13,12 +13,13 @@ final readonly class PdfWriter implements WriterInterface { - public const WRITER_OPTION_UNIT = 'unit'; - public const WRITER_OPTION_PDF = 'fpdf'; - public const WRITER_OPTION_X = 'x'; - public const WRITER_OPTION_Y = 'y'; - public const WRITER_OPTION_LINK = 'link'; + public const string WRITER_OPTION_UNIT = 'unit'; + public const string WRITER_OPTION_PDF = 'fpdf'; + public const string WRITER_OPTION_X = 'x'; + public const string WRITER_OPTION_Y = 'y'; + public const string WRITER_OPTION_LINK = 'link'; + #[\Override] public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, array $options = []): ResultInterface { $matrixFactory = new MatrixFactory(); diff --git a/src/Writer/PngWriter.php b/src/Writer/PngWriter.php index 2bfcd97..e064158 100644 --- a/src/Writer/PngWriter.php +++ b/src/Writer/PngWriter.php @@ -13,9 +13,10 @@ final readonly class PngWriter extends AbstractGdWriter { - public const WRITER_OPTION_COMPRESSION_LEVEL = 'compression_level'; - public const WRITER_OPTION_NUMBER_OF_COLORS = 'number_of_colors'; + public const string WRITER_OPTION_COMPRESSION_LEVEL = 'compression_level'; + public const string WRITER_OPTION_NUMBER_OF_COLORS = 'number_of_colors'; + #[\Override] public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, array $options = []): ResultInterface { if (!isset($options[self::WRITER_OPTION_COMPRESSION_LEVEL])) { diff --git a/src/Writer/Result/BinaryResult.php b/src/Writer/Result/BinaryResult.php index 386fb6a..0587ce1 100644 --- a/src/Writer/Result/BinaryResult.php +++ b/src/Writer/Result/BinaryResult.php @@ -13,6 +13,7 @@ public function __construct(MatrixInterface $matrix) parent::__construct($matrix); } + #[\Override] public function getString(): string { $matrix = $this->getMatrix(); @@ -28,6 +29,7 @@ public function getString(): string return $binaryString; } + #[\Override] public function getMimeType(): string { return 'text/plain'; diff --git a/src/Writer/Result/ConsoleResult.php b/src/Writer/Result/ConsoleResult.php index d3644db..e325881 100644 --- a/src/Writer/Result/ConsoleResult.php +++ b/src/Writer/Result/ConsoleResult.php @@ -9,7 +9,7 @@ final class ConsoleResult extends AbstractResult { - private const TWO_BLOCKS = [ + private const array TWO_BLOCKS = [ 0 => ' ', 1 => "\xe2\x96\x80", 2 => "\xe2\x96\x84", @@ -36,11 +36,13 @@ public function __construct( ); } + #[\Override] public function getMimeType(): string { return 'text/plain'; } + #[\Override] public function getString(): string { $matrix = $this->getMatrix(); diff --git a/src/Writer/Result/DebugResult.php b/src/Writer/Result/DebugResult.php index b632993..9cc15b0 100644 --- a/src/Writer/Result/DebugResult.php +++ b/src/Writer/Result/DebugResult.php @@ -29,6 +29,7 @@ public function setValidateResult(bool $validateResult): void $this->validateResult = $validateResult; } + #[\Override] public function getString(): string { $debugLines = []; @@ -67,6 +68,7 @@ public function getString(): string return implode("\n", $debugLines); } + #[\Override] public function getMimeType(): string { return 'text/plain'; diff --git a/src/Writer/Result/EpsResult.php b/src/Writer/Result/EpsResult.php index d801fd6..2591211 100644 --- a/src/Writer/Result/EpsResult.php +++ b/src/Writer/Result/EpsResult.php @@ -16,11 +16,13 @@ public function __construct( parent::__construct($matrix); } + #[\Override] public function getString(): string { return implode("\n", $this->lines); } + #[\Override] public function getMimeType(): string { return 'image/eps'; diff --git a/src/Writer/Result/GdResult.php b/src/Writer/Result/GdResult.php index a58c3e4..1b6d859 100644 --- a/src/Writer/Result/GdResult.php +++ b/src/Writer/Result/GdResult.php @@ -20,11 +20,13 @@ public function getImage(): \GdImage return $this->image; } + #[\Override] public function getString(): string { throw new \Exception('You can only use this method in a concrete implementation'); } + #[\Override] public function getMimeType(): string { throw new \Exception('You can only use this method in a concrete implementation'); diff --git a/src/Writer/Result/GifResult.php b/src/Writer/Result/GifResult.php index 84b2497..02f90f7 100644 --- a/src/Writer/Result/GifResult.php +++ b/src/Writer/Result/GifResult.php @@ -6,6 +6,7 @@ final class GifResult extends GdResult { + #[\Override] public function getString(): string { ob_start(); @@ -14,6 +15,7 @@ public function getString(): string return strval(ob_get_clean()); } + #[\Override] public function getMimeType(): string { return 'image/gif'; diff --git a/src/Writer/Result/PdfResult.php b/src/Writer/Result/PdfResult.php index f7746a2..f8c1f6e 100644 --- a/src/Writer/Result/PdfResult.php +++ b/src/Writer/Result/PdfResult.php @@ -20,11 +20,13 @@ public function getPdf(): \FPDF return $this->fpdf; } + #[\Override] public function getString(): string { return $this->fpdf->Output('S'); } + #[\Override] public function getMimeType(): string { return 'application/pdf'; diff --git a/src/Writer/Result/PngResult.php b/src/Writer/Result/PngResult.php index 8cdbc53..b865de3 100644 --- a/src/Writer/Result/PngResult.php +++ b/src/Writer/Result/PngResult.php @@ -17,6 +17,7 @@ public function __construct( parent::__construct($matrix, $image); } + #[\Override] public function getString(): string { ob_start(); @@ -28,6 +29,7 @@ public function getString(): string return strval(ob_get_clean()); } + #[\Override] public function getMimeType(): string { return 'image/png'; diff --git a/src/Writer/Result/SvgResult.php b/src/Writer/Result/SvgResult.php index 2c9d281..f178c18 100644 --- a/src/Writer/Result/SvgResult.php +++ b/src/Writer/Result/SvgResult.php @@ -21,6 +21,7 @@ public function getXml(): \SimpleXMLElement return $this->xml; } + #[\Override] public function getString(): string { $string = $this->xml->asXML(); @@ -36,6 +37,7 @@ public function getString(): string return $string; } + #[\Override] public function getMimeType(): string { return 'image/svg+xml'; diff --git a/src/Writer/Result/WebPResult.php b/src/Writer/Result/WebPResult.php index 735f128..af86bc9 100644 --- a/src/Writer/Result/WebPResult.php +++ b/src/Writer/Result/WebPResult.php @@ -16,6 +16,7 @@ public function __construct( parent::__construct($matrix, $image); } + #[\Override] public function getString(): string { if (!function_exists('imagewebp')) { @@ -28,6 +29,7 @@ public function getString(): string return strval(ob_get_clean()); } + #[\Override] public function getMimeType(): string { return 'image/webp'; diff --git a/src/Writer/SvgWriter.php b/src/Writer/SvgWriter.php index 9001279..f34be86 100644 --- a/src/Writer/SvgWriter.php +++ b/src/Writer/SvgWriter.php @@ -15,13 +15,14 @@ final readonly class SvgWriter implements WriterInterface { - public const DECIMAL_PRECISION = 2; - public const WRITER_OPTION_COMPACT = 'compact'; - public const WRITER_OPTION_BLOCK_ID = 'block_id'; - public const WRITER_OPTION_EXCLUDE_XML_DECLARATION = 'exclude_xml_declaration'; - public const WRITER_OPTION_EXCLUDE_SVG_WIDTH_AND_HEIGHT = 'exclude_svg_width_and_height'; - public const WRITER_OPTION_FORCE_XLINK_HREF = 'force_xlink_href'; - + public const int DECIMAL_PRECISION = 2; + public const string WRITER_OPTION_COMPACT = 'compact'; + public const string WRITER_OPTION_BLOCK_ID = 'block_id'; + public const string WRITER_OPTION_EXCLUDE_XML_DECLARATION = 'exclude_xml_declaration'; + public const string WRITER_OPTION_EXCLUDE_SVG_WIDTH_AND_HEIGHT = 'exclude_svg_width_and_height'; + public const string WRITER_OPTION_FORCE_XLINK_HREF = 'force_xlink_href'; + + #[\Override] public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, array $options = []): ResultInterface { if (!isset($options[self::WRITER_OPTION_COMPACT])) { diff --git a/src/Writer/WebPWriter.php b/src/Writer/WebPWriter.php index 2a95f35..a0e4fdc 100644 --- a/src/Writer/WebPWriter.php +++ b/src/Writer/WebPWriter.php @@ -13,8 +13,9 @@ final readonly class WebPWriter extends AbstractGdWriter { - public const WRITER_OPTION_QUALITY = 'quality'; + public const string WRITER_OPTION_QUALITY = 'quality'; + #[\Override] public function write(QrCodeInterface $qrCode, ?LogoInterface $logo = null, ?LabelInterface $label = null, array $options = []): ResultInterface { if (!isset($options[self::WRITER_OPTION_QUALITY])) {