Skip to content

Commit 8c502df

Browse files
authored
Merge pull request #515 from Chris53897/feature/php-84
feat: fix PHP 8.4 deprecations
2 parents 5388a1a + 3a05d20 commit 8c502df

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/Knp/Snappy/AbstractGenerator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ abstract class AbstractGenerator implements GeneratorInterface, LoggerAwareInter
6565
* @param array $options
6666
* @param null|array $env
6767
*/
68-
public function __construct($binary, array $options = [], array $env = null)
68+
public function __construct($binary, array $options = [], array|null $env = null)
6969
{
7070
$this->configure();
7171

src/Knp/Snappy/Image.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Image extends AbstractGenerator
1313
/**
1414
* {@inheritdoc}
1515
*/
16-
public function __construct($binary = null, array $options = [], array $env = null)
16+
public function __construct($binary = null, array $options = [], array|null $env = null)
1717
{
1818
$this->setDefaultExtension('jpg');
1919

src/Knp/Snappy/Pdf.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Pdf extends AbstractGenerator
1818
/**
1919
* {@inheritdoc}
2020
*/
21-
public function __construct($binary = null, array $options = [], array $env = null)
21+
public function __construct($binary = null, array $options = [], array|null $env = null)
2222
{
2323
$this->setDefaultExtension('pdf');
2424
$this->setOptionsWithContentCheck();

tests/Knp/Snappy/PdfTest.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
namespace Tests\Knp\Snappy;
44

55
use Knp\Snappy\Pdf;
6-
use PHPUnit\Framework\Error\Error;
76
use PHPUnit\Framework\TestCase;
87
use RecursiveDirectoryIterator;
98
use FilesystemIterator;
109
use CallbackFilterIterator;
1110
use DirectoryIterator;
1211
use ReflectionMethod;
12+
use RuntimeException;
1313

1414
class PdfTest extends TestCase
1515
{
@@ -79,8 +79,9 @@ public function testRemovesLocalFilesOnError(): void
7979
$method->setAccessible(true);
8080
$method->invoke($pdf, 'test', $pdf->getDefaultExtension());
8181
$this->assertEquals(1, \count($pdf->temporaryFiles));
82-
$this->expectException(Error::class);
83-
\trigger_error('test error', \E_USER_ERROR);
82+
$this->expectException(RuntimeException::class);
83+
84+
throw new RuntimeException('test error.');
8485
// @phpstan-ignore-next-line See https://github.com/phpstan/phpstan/issues/7799
8586
$this->assertFileNotExists(\reset($pdf->temporaryFiles));
8687
}

0 commit comments

Comments
 (0)