diff --git a/src/FpdfTpl.php b/src/FpdfTpl.php index e6a15e7d..9b6cba3d 100644 --- a/src/FpdfTpl.php +++ b/src/FpdfTpl.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/FpdfTplTrait.php b/src/FpdfTplTrait.php index 9988f706..772997aa 100644 --- a/src/FpdfTplTrait.php +++ b/src/FpdfTplTrait.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/FpdfTrait.php b/src/FpdfTrait.php index e48ee9d9..090b5d5d 100644 --- a/src/FpdfTrait.php +++ b/src/FpdfTrait.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -137,7 +137,7 @@ protected function _putlinks($n) { foreach ($this->PageLinks[$n] as $pl) { $this->_newobj(); - $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]); + $rect = \sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]); $this->_put('<_put($s); @@ -172,7 +172,7 @@ protected function _putlinks($n) ? $this->DefPageSize[1] * $this->k : $this->DefPageSize[0] * $this->k; } - $this->_put(sprintf( + $this->_put(\sprintf( '/Dest [%d 0 R /XYZ 0 %.2F null]>>', $this->PageInfo[$l[0]]['n'], $h - $l[1] * $this->k diff --git a/src/Fpdi.php b/src/Fpdi.php index 147daeea..945cd2ba 100644 --- a/src/Fpdi.php +++ b/src/Fpdi.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/FpdiException.php b/src/FpdiException.php index a178c412..738a75c9 100644 --- a/src/FpdiException.php +++ b/src/FpdiException.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/FpdiTrait.php b/src/FpdiTrait.php index a15cafee..6626287e 100644 --- a/src/FpdiTrait.php +++ b/src/FpdiTrait.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -313,7 +313,7 @@ public function importPage( $dict->value['Resources'] = $resources; } - list($width, $height) = $page->getWidthAndHeight($box); + [$width, $height] = $page->getWidthAndHeight($box); $a = 1; $b = 0; @@ -522,11 +522,11 @@ public function useImportedPage($pageId, $x = 0, $y = 0, $width = null, $height protected function adjustLastLink($externalLink, $xPt, $scaleX, $yPt, $newHeightPt, $scaleY, $importedPage) { // let's create a relation of the newly created link to the data of the external link - $lastLink = count($this->PageLinks[$this->page]); + $lastLink = \count($this->PageLinks[$this->page]); $this->PageLinks[$this->page][$lastLink - 1]['importedLink'] = $externalLink; - if (count($externalLink['quadPoints']) > 0) { + if (\count($externalLink['quadPoints']) > 0) { $quadPoints = []; - for ($i = 0, $n = count($externalLink['quadPoints']); $i < $n; $i += 2) { + for ($i = 0, $n = \count($externalLink['quadPoints']); $i < $n; $i += 2) { $quadPoints[] = $xPt + $externalLink['quadPoints'][$i] * $scaleX; $quadPoints[] = $this->hPt - $yPt - $newHeightPt + $externalLink['quadPoints'][$i + 1] * $scaleY; } diff --git a/src/GraphicsState.php b/src/GraphicsState.php index 44641819..bc24d258 100644 --- a/src/GraphicsState.php +++ b/src/GraphicsState.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -53,13 +53,13 @@ public function add(Matrix $matrix) */ public function rotate($x, $y, $angle) { - if (abs($angle) < 1e-5) { + if (\abs($angle) < 1e-5) { return $this; } - $angle = deg2rad($angle); - $c = cos($angle); - $s = sin($angle); + $angle = \deg2rad($angle); + $c = \cos($angle); + $s = \sin($angle); $this->add(new Matrix($c, $s, -$s, $c, $x, $y)); diff --git a/src/Math/Matrix.php b/src/Math/Matrix.php index 578bdc88..f8349a4a 100644 --- a/src/Math/Matrix.php +++ b/src/Math/Matrix.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/Math/Vector.php b/src/Math/Vector.php index fe203482..e0105218 100644 --- a/src/Math/Vector.php +++ b/src/Math/Vector.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -57,7 +57,7 @@ public function getY() */ public function multiplyWithMatrix(Matrix $matrix) { - list($a, $b, $c, $d, $e, $f) = $matrix->getValues(); + [$a, $b, $c, $d, $e, $f] = $matrix->getValues(); $x = $a * $this->x + $c * $this->y + $e; $y = $b * $this->x + $d * $this->y + $f; diff --git a/src/PdfParser/CrossReference/AbstractReader.php b/src/PdfParser/CrossReference/AbstractReader.php index 2127f448..bd093912 100644 --- a/src/PdfParser/CrossReference/AbstractReader.php +++ b/src/PdfParser/CrossReference/AbstractReader.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/CrossReference/CrossReference.php b/src/PdfParser/CrossReference/CrossReference.php index 1cbe0e21..2bdb6298 100644 --- a/src/PdfParser/CrossReference/CrossReference.php +++ b/src/PdfParser/CrossReference/CrossReference.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/CrossReference/CrossReferenceException.php b/src/PdfParser/CrossReference/CrossReferenceException.php index 412b375e..41d968e3 100644 --- a/src/PdfParser/CrossReference/CrossReferenceException.php +++ b/src/PdfParser/CrossReference/CrossReferenceException.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/CrossReference/FixedReader.php b/src/PdfParser/CrossReference/FixedReader.php index 7871f67c..6f81bb1b 100644 --- a/src/PdfParser/CrossReference/FixedReader.php +++ b/src/PdfParser/CrossReference/FixedReader.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -62,7 +62,7 @@ public function getSubSections() */ public function getOffsetFor($objectNumber) { - foreach ($this->subSections as $offset => list($startObject, $objectCount)) { + foreach ($this->subSections as $offset => [$startObject, $objectCount]) { /** * @var int $startObject * @var int $objectCount @@ -189,7 +189,7 @@ public function fixFaultySubSectionShift() } if ($this->getOffsetFor(1) === false) { - foreach ($subSections as $offset => list($startObject, $objectCount)) { + foreach ($subSections as $offset => [$startObject, $objectCount]) { $this->subSections[$offset] = [$startObject - 1, $objectCount]; } return true; diff --git a/src/PdfParser/CrossReference/LineReader.php b/src/PdfParser/CrossReference/LineReader.php index c921fe74..bd18ea0e 100644 --- a/src/PdfParser/CrossReference/LineReader.php +++ b/src/PdfParser/CrossReference/LineReader.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/CrossReference/ReaderInterface.php b/src/PdfParser/CrossReference/ReaderInterface.php index a98fb135..09ff2293 100644 --- a/src/PdfParser/CrossReference/ReaderInterface.php +++ b/src/PdfParser/CrossReference/ReaderInterface.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Filter/Ascii85.php b/src/PdfParser/Filter/Ascii85.php index f3efd4c8..307aca3e 100644 --- a/src/PdfParser/Filter/Ascii85.php +++ b/src/PdfParser/Filter/Ascii85.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -47,7 +47,7 @@ public function decode($data) } if ($ch === 122 /* z */ && $state === 0) { - $out .= \chr(0) . \chr(0) . \chr(0) . \chr(0); + $out .= "\x00\x00\x00\x00"; continue; } @@ -69,10 +69,10 @@ public function decode($data) $r = (int)($r * 85 + $chn[$j]); } - $out .= \chr($r >> 24) - . \chr($r >> 16) - . \chr($r >> 8) - . \chr($r); + $out .= \chr(($r >> 24) & 255) + . \chr(($r >> 16) & 255) + . \chr(($r >> 8) & 255) + . \chr($r & 255); } } @@ -85,16 +85,16 @@ public function decode($data) if ($state === 2) { $r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1] + 1) * 85 * 85 * 85; - $out .= \chr($r >> 24); + $out .= \chr(($r >> 24) & 255); } elseif ($state === 3) { $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + ($chn[2] + 1) * 85 * 85; - $out .= \chr($r >> 24); - $out .= \chr($r >> 16); + $out .= \chr(($r >> 24) & 255); + $out .= \chr(($r >> 16) & 255); } elseif ($state === 4) { $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + $chn[2] * 85 * 85 + ($chn[3] + 1) * 85; - $out .= \chr($r >> 24); - $out .= \chr($r >> 16); - $out .= \chr($r >> 8); + $out .= \chr(($r >> 24) & 255); + $out .= \chr(($r >> 16) & 255); + $out .= \chr(($r >> 8) & 255); } return $out; diff --git a/src/PdfParser/Filter/Ascii85Exception.php b/src/PdfParser/Filter/Ascii85Exception.php index e37eaa7d..9c580434 100644 --- a/src/PdfParser/Filter/Ascii85Exception.php +++ b/src/PdfParser/Filter/Ascii85Exception.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Filter/AsciiHex.php b/src/PdfParser/Filter/AsciiHex.php index 1eb4a792..243eda20 100644 --- a/src/PdfParser/Filter/AsciiHex.php +++ b/src/PdfParser/Filter/AsciiHex.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Filter/FilterException.php b/src/PdfParser/Filter/FilterException.php index 18a07ce0..7ecd67f4 100644 --- a/src/PdfParser/Filter/FilterException.php +++ b/src/PdfParser/Filter/FilterException.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Filter/FilterInterface.php b/src/PdfParser/Filter/FilterInterface.php index 93d7996d..6659d357 100644 --- a/src/PdfParser/Filter/FilterInterface.php +++ b/src/PdfParser/Filter/FilterInterface.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Filter/Flate.php b/src/PdfParser/Filter/Flate.php index 83bc0e24..890b9816 100644 --- a/src/PdfParser/Filter/Flate.php +++ b/src/PdfParser/Filter/Flate.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Filter/FlateException.php b/src/PdfParser/Filter/FlateException.php index aa3a2b39..a6ef2e21 100644 --- a/src/PdfParser/Filter/FlateException.php +++ b/src/PdfParser/Filter/FlateException.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Filter/Lzw.php b/src/PdfParser/Filter/Lzw.php index 54c3b78c..506c9d54 100644 --- a/src/PdfParser/Filter/Lzw.php +++ b/src/PdfParser/Filter/Lzw.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Filter/LzwException.php b/src/PdfParser/Filter/LzwException.php index 297edacd..473659e9 100644 --- a/src/PdfParser/Filter/LzwException.php +++ b/src/PdfParser/Filter/LzwException.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/PdfParser.php b/src/PdfParser/PdfParser.php index 02af9ca7..61fec513 100644 --- a/src/PdfParser/PdfParser.php +++ b/src/PdfParser/PdfParser.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -177,7 +177,7 @@ public function getPdfVersion() PdfParserException::PDF_VERSION_NOT_FOUND ); } - list(, $major, $minor) = $result; + [, $major, $minor] = $result; $catalog = $this->getCatalog(); if (isset($catalog->value['Version'])) { @@ -186,7 +186,7 @@ public function getPdfVersion() PdfName::unescape(PdfType::resolve($catalog->value['Version'], $this)->value) ); if (count($versionParts) === 2) { - list($major, $minor) = $versionParts; + [$major, $minor] = $versionParts; } } diff --git a/src/PdfParser/PdfParserException.php b/src/PdfParser/PdfParserException.php index b2264ab3..831e4909 100644 --- a/src/PdfParser/PdfParserException.php +++ b/src/PdfParser/PdfParserException.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/StreamReader.php b/src/PdfParser/StreamReader.php index 3018418e..9b847c37 100644 --- a/src/PdfParser/StreamReader.php +++ b/src/PdfParser/StreamReader.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Tokenizer.php b/src/PdfParser/Tokenizer.php index 889d036c..60977113 100644 --- a/src/PdfParser/Tokenizer.php +++ b/src/PdfParser/Tokenizer.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfArray.php b/src/PdfParser/Type/PdfArray.php index 15f55497..5b73461a 100644 --- a/src/PdfParser/Type/PdfArray.php +++ b/src/PdfParser/Type/PdfArray.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfBoolean.php b/src/PdfParser/Type/PdfBoolean.php index 3007a65f..9816f0d9 100644 --- a/src/PdfParser/Type/PdfBoolean.php +++ b/src/PdfParser/Type/PdfBoolean.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfDictionary.php b/src/PdfParser/Type/PdfDictionary.php index db4009ca..15fbc98d 100644 --- a/src/PdfParser/Type/PdfDictionary.php +++ b/src/PdfParser/Type/PdfDictionary.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfHexString.php b/src/PdfParser/Type/PdfHexString.php index 309706b3..eee454c5 100644 --- a/src/PdfParser/Type/PdfHexString.php +++ b/src/PdfParser/Type/PdfHexString.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfIndirectObject.php b/src/PdfParser/Type/PdfIndirectObject.php index ce51d48d..f5735155 100644 --- a/src/PdfParser/Type/PdfIndirectObject.php +++ b/src/PdfParser/Type/PdfIndirectObject.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfIndirectObjectReference.php b/src/PdfParser/Type/PdfIndirectObjectReference.php index 1ace3784..53d7f0e8 100644 --- a/src/PdfParser/Type/PdfIndirectObjectReference.php +++ b/src/PdfParser/Type/PdfIndirectObjectReference.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfName.php b/src/PdfParser/Type/PdfName.php index 3732aecc..8e3a5575 100644 --- a/src/PdfParser/Type/PdfName.php +++ b/src/PdfParser/Type/PdfName.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -45,12 +45,12 @@ public static function parse(Tokenizer $tokenizer, StreamReader $streamReader) */ public static function unescape($value) { - if (strpos($value, '#') === false) { + if (\strpos($value, '#') === false) { return $value; } - return preg_replace_callback('/#([a-fA-F\d]{2})/', function ($matches) { - return chr(hexdec($matches[1])); + return \preg_replace_callback('/#([a-fA-F\d]{2})/', function ($matches) { + return \chr(\hexdec($matches[1])); }, $value); } diff --git a/src/PdfParser/Type/PdfNull.php b/src/PdfParser/Type/PdfNull.php index 7aef3633..b8987615 100644 --- a/src/PdfParser/Type/PdfNull.php +++ b/src/PdfParser/Type/PdfNull.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfNumeric.php b/src/PdfParser/Type/PdfNumeric.php index dd8b3dda..369240fd 100644 --- a/src/PdfParser/Type/PdfNumeric.php +++ b/src/PdfParser/Type/PdfNumeric.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfStream.php b/src/PdfParser/Type/PdfStream.php index 0a403687..7c0d31eb 100644 --- a/src/PdfParser/Type/PdfStream.php +++ b/src/PdfParser/Type/PdfStream.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -147,7 +147,7 @@ public function getStream($cache = false) $this->reader->reset($this->stream + strlen($buffer)); $this->parser->getTokenizer()->clearStack(); $token = $this->parser->readValue(); - if ($token === false || !($token instanceof PdfToken) || $token->value !== 'endstream') { + if (!($token instanceof PdfToken) || $token->value !== 'endstream') { $this->reader->reset($this->stream, 100000); $buffer = $this->extractStream(); $this->reader->reset($this->stream + strlen($buffer)); @@ -205,7 +205,7 @@ protected function extractStream() // There are streams in the wild, which have only white signs in them but need to be parsed manually due // to a problem encountered before (e.g. Length === 0). We should set them to empty streams to avoid problems // in further processing (e.g. applying of filters). - if (trim($buffer) === '') { + if (\trim($buffer) === '') { $buffer = ''; } diff --git a/src/PdfParser/Type/PdfString.php b/src/PdfParser/Type/PdfString.php index 89b90c5d..7d6ec044 100644 --- a/src/PdfParser/Type/PdfString.php +++ b/src/PdfParser/Type/PdfString.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfToken.php b/src/PdfParser/Type/PdfToken.php index a0de203e..5d463db9 100644 --- a/src/PdfParser/Type/PdfToken.php +++ b/src/PdfParser/Type/PdfToken.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfType.php b/src/PdfParser/Type/PdfType.php index b32eb442..6dcfbdd6 100644 --- a/src/PdfParser/Type/PdfType.php +++ b/src/PdfParser/Type/PdfType.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfParser/Type/PdfTypeException.php b/src/PdfParser/Type/PdfTypeException.php index 3d2b93cd..3cd9d29d 100644 --- a/src/PdfParser/Type/PdfTypeException.php +++ b/src/PdfParser/Type/PdfTypeException.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfReader/DataStructure/Rectangle.php b/src/PdfReader/DataStructure/Rectangle.php index 9f5cd745..688f6e22 100644 --- a/src/PdfReader/DataStructure/Rectangle.php +++ b/src/PdfReader/DataStructure/Rectangle.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfReader/Page.php b/src/PdfReader/Page.php index c2463dd2..91f74e0e 100644 --- a/src/PdfReader/Page.php +++ b/src/PdfReader/Page.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -118,7 +118,7 @@ public function getAttribute($name, $inherited = true) if ($inherited && \in_array($name, $inheritedKeys, true)) { if ($this->inheritedAttributes === null) { $this->inheritedAttributes = []; - $inheritedKeys = \array_filter($inheritedKeys, function ($key) use ($dict) { + $inheritedKeys = \array_filter($inheritedKeys, static function ($key) use ($dict) { return !isset($dict->value[$key]); }); @@ -334,7 +334,7 @@ public function getExternalLinks($box = PageBoundaries::CROP_BOX) } $rect = PdfType::resolve(PdfDictionary::get($annotation, 'Rect'), $this->parser); - if (!$rect instanceof PdfArray || count($rect->value) !== 4) { + if (!$rect instanceof PdfArray || \count($rect->value) !== 4) { continue; } @@ -370,7 +370,7 @@ public function getExternalLinks($box = PageBoundaries::CROP_BOX) $quadPoints = PdfType::resolve(PdfDictionary::get($annotation, 'QuadPoints'), $this->parser); $normalizedQuadPoints = []; if ($quadPoints instanceof PdfArray) { - $quadPointsCount = count($quadPoints->value); + $quadPointsCount = \count($quadPoints->value); if ($quadPointsCount % 8 === 0) { for ($i = 0; ($i + 1) < $quadPointsCount; $i += 2) { $x = PdfNumeric::ensure(PdfType::resolve($quadPoints->value[$i], $this->parser)); diff --git a/src/PdfReader/PageBoundaries.php b/src/PdfReader/PageBoundaries.php index 35154218..246fd3b5 100644 --- a/src/PdfReader/PageBoundaries.php +++ b/src/PdfReader/PageBoundaries.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/PdfReader/PdfReader.php b/src/PdfReader/PdfReader.php index d55de618..2af777f8 100644 --- a/src/PdfReader/PdfReader.php +++ b/src/PdfReader/PdfReader.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -124,6 +124,8 @@ public function getPage($pageNumber) ); } + $pageNumber = (int)$pageNumber; + if ($pageNumber < 1 || $pageNumber > $this->getPageCount()) { throw new \InvalidArgumentException( \sprintf( diff --git a/src/PdfReader/PdfReaderException.php b/src/PdfReader/PdfReaderException.php index ecebdb96..dc839a56 100644 --- a/src/PdfReader/PdfReaderException.php +++ b/src/PdfReader/PdfReaderException.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/Tcpdf/Fpdi.php b/src/Tcpdf/Fpdi.php index 7d3161e8..da2f3412 100644 --- a/src/Tcpdf/Fpdi.php +++ b/src/Tcpdf/Fpdi.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ @@ -293,10 +293,10 @@ protected function adjustLastLink($externalLink, $xPt, $scaleX, $yPt, $newHeight if ($this->inxobj) { // store parameters for later use on template - $lastAnnotationKey = count($this->xobjects[$this->xobjid]['annotations']) - 1; + $lastAnnotationKey = \count($this->xobjects[$this->xobjid]['annotations']) - 1; $lastAnnotationOpt = &$this->xobjects[$this->xobjid]['annotations'][$lastAnnotationKey]['opt']; } else { - $lastAnnotationKey = count($this->PageAnnots[$this->page]) - 1; + $lastAnnotationKey = \count($this->PageAnnots[$this->page]) - 1; $lastAnnotationOpt = &$this->PageAnnots[$this->page][$lastAnnotationKey]['opt']; } @@ -356,7 +356,7 @@ protected function adjustLastLink($externalLink, $xPt, $scaleX, $yPt, $newHeight case 'C': $c = []; $colors = PdfArray::ensure(PdfType::resolve($value, $parser))->value; - $m = count($colors) === 4 ? 100 : 255; + $m = \count($colors) === 4 ? 100 : 255; foreach ($colors as $item) { $c[] = PdfNumeric::ensure($item)->value * $m; } diff --git a/src/TcpdfFpdi.php b/src/TcpdfFpdi.php index 84f68196..74263b6d 100644 --- a/src/TcpdfFpdi.php +++ b/src/TcpdfFpdi.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/Tfpdf/FpdfTpl.php b/src/Tfpdf/FpdfTpl.php index 6cf8a6cd..93f3bc88 100644 --- a/src/Tfpdf/FpdfTpl.php +++ b/src/Tfpdf/FpdfTpl.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/Tfpdf/Fpdi.php b/src/Tfpdf/Fpdi.php index b6d27b09..f9a460c9 100644 --- a/src/Tfpdf/Fpdi.php +++ b/src/Tfpdf/Fpdi.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ diff --git a/src/autoload.php b/src/autoload.php index cace75bd..44e4d005 100644 --- a/src/autoload.php +++ b/src/autoload.php @@ -4,7 +4,7 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2024 Setasign GmbH & Co. KG (https://www.setasign.com) + * @copyright Copyright (c) 2026 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */