Skip to content

Commit 028181b

Browse files
committed
feat: fix PHP 8.4 deprecations
1 parent 5388a1a commit 028181b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ 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+
throw new \RuntimeException('test error');
8484
// @phpstan-ignore-next-line See https://github.com/phpstan/phpstan/issues/7799
8585
$this->assertFileNotExists(\reset($pdf->temporaryFiles));
8686
}

0 commit comments

Comments
 (0)