Skip to content

Commit 409f9e1

Browse files
authored
Merge pull request #14 from jobcloud/chore/PRO-3016/php84-forward-compatibility
chore(PRO-3016): PHP 8.4 forward compatibility
2 parents 6efae33 + 32e9dc0 commit 409f9e1

40 files changed

Lines changed: 96 additions & 111 deletions

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,25 @@
1010
"authors": [
1111
{
1212
"name": "Piotr Śliwa",
13-
"homepage": "http://ohey.pl",
13+
"homepage": "https://ohey.pl",
1414
"email": "peter.pl7@gmail.com"
1515
}
1616
],
1717
"repositories": [
18+
{"type": "vcs", "no-api": true, "url": "git@github.com:jobcloud/laminas-memory.git"},
1819
{"type": "vcs", "no-api": true, "url": "git@github.com:jobcloud/zendpdf.git"}
1920
],
2021
"require": {
21-
"php": "^8.2",
22+
"php": "^8.4",
2223
"ext-iconv": "*",
2324
"ext-libxml": "*",
2425
"ext-mbstring": "*",
2526
"ext-xmlreader": "*",
26-
"jobcloud/zendpdf": "^3.0.0"
27+
"jobcloud/zendpdf": "^4.0.0"
2728
},
2829
"require-dev": {
2930
"imagine/imagine": ">=0.2.0,<0.6.0",
30-
"phpunit/phpunit": "^8.5.42"
31+
"phpunit/phpunit": "^8.5.44"
3132
},
3233
"prefer-stable": true,
3334
"minimum-stability": "dev",

docker/php/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.3-alpine3.22
1+
FROM php:8.4-alpine3.22
22

33
ARG USER_ID
44

lib/PHPPdf/Bridge/Zend/Pdf/Resource/Image/Tiff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public function __construct($imageFileName)
263263
\ZendPdf\Resource\Image::__construct();
264264

265265
$imageDictionary = $this->_resource->dictionary;
266-
if(!isset($this->_width) || !isset($this->_width)) {
266+
if(!isset($this->_width) || !isset($this->_height)) {
267267
throw new Exception\CorruptedImageException('Problem reading tiff file. Tiff is probably corrupt.');
268268
}
269269

lib/PHPPdf/Cache/CacheImpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private function createAdapter($name)
6969
return StorageFactory::adapterFactory($name);
7070
}
7171

72-
private function cacheEngineDosntExistException($engine, \Exception $e = null)
72+
private function cacheEngineDosntExistException($engine, ?\Exception $e = null)
7373
{
7474
return new RuntimeException(sprintf('Cache engine "%s" dosn\'t exist.', $engine), 1, $e);
7575
}

lib/PHPPdf/Core/Document.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function draw($pages)
155155
{
156156
if($this->isProcessed())
157157
{
158-
throw new LogicException(sprintf('Pdf has alredy been drawed.'));
158+
throw new LogicException('Pdf has alredy been drawed.');
159159
}
160160

161161
$this->processed = true;

lib/PHPPdf/Core/DrawingTaskHeap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class DrawingTaskHeap extends \SplHeap
1919
{
2020
private $elements = 0;
2121

22-
public function insert($value): bool
22+
public function insert($value): true
2323
{
2424
$value->setOrder($this->elements++);
2525
parent::insert($value);

lib/PHPPdf/Core/Engine/AbstractEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace PHPPdf\Core\Engine;
1010

11-
use PHPPdf\Core\UnitConverter;
11+
use PHPPdf\Core\UnitConverter;
1212

1313
/**
1414
* Abstract engine
@@ -19,7 +19,7 @@ abstract class AbstractEngine implements Engine
1919
{
2020
protected $unitConverter;
2121

22-
public function __construct(UnitConverter $unitConverter = null)
22+
public function __construct(?UnitConverter $unitConverter = null)
2323
{
2424
$this->unitConverter = $unitConverter;
2525
}

lib/PHPPdf/Core/Engine/EngineFactoryImpl.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
namespace PHPPdf\Core\Engine;
1010

11-
use PHPPdf\Core\ImageUnitConverter;
12-
use PHPPdf\Core\PdfUnitConverter;
13-
use PHPPdf\Exception\DomainException;
11+
use PHPPdf\Core\ImageUnitConverter;
12+
use PHPPdf\Core\PdfUnitConverter;
13+
use PHPPdf\Exception\DomainException;
1414
use PHPPdf\Core\Engine\Imagine\Engine as ImagineEngine;
1515
use PHPPdf\Core\Engine\ZF\Engine as ZendEngine;
1616

@@ -51,7 +51,7 @@ public function createEngine($type, array $options = array())
5151

5252
$imagineClass = sprintf('Imagine\%s\Imagine', $engine);
5353

54-
if(!class_exists($imagineClass, true))
54+
if(!class_exists($imagineClass))
5555
{
5656
throw new DomainException(sprintf('Unknown image engine type "%s" or Imagine library is not installed.', $engine));
5757
}

lib/PHPPdf/Core/Engine/GraphicsContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ public function drawLine($x1, $y1, $x2, $y2);
5050
public function setFont(Font $font, $size);
5151

5252
/**
53-
* @param string String representing color
53+
* @param string $color String representing color
5454
*/
5555
public function setFillColor($color);
5656

5757
/**
58-
* @param string String representing color
58+
* @param string $color String representing color
5959
*/
6060
public function setLineColor($color);
6161

lib/PHPPdf/Core/Engine/Imagine/Engine.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace PHPPdf\Core\Engine\Imagine;
1010

11-
use PHPPdf\Exception\InvalidResourceException;
11+
use PHPPdf\Exception\InvalidResourceException;
1212
use PHPPdf\Core\Engine\AbstractEngine;
1313
use PHPPdf\Core\UnitConverter;
1414
use Imagine\Image\ImagineInterface;
@@ -23,11 +23,11 @@
2323
class Engine extends AbstractEngine
2424
{
2525
private $imagine;
26-
private $graphicsContexts = array();
26+
private $graphicsContexts = [];
2727
private $outputFormat;
2828
private $renderOptions;
2929

30-
public function __construct(ImagineInterface $imagine, $outputFormat, UnitConverter $unitConverter = null, array $renderOptions = array())
30+
public function __construct(ImagineInterface $imagine, $outputFormat, ?UnitConverter $unitConverter = null, array $renderOptions = [])
3131
{
3232
parent::__construct($unitConverter);
3333
$this->imagine = $imagine;

0 commit comments

Comments
 (0)