Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Knp/Snappy/AbstractGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ abstract class AbstractGenerator implements GeneratorInterface, LoggerAwareInter
* @param array $options
* @param null|array $env
*/
public function __construct($binary, array $options = [], array $env = null)
public function __construct($binary, array $options = [], array|null $env = null)
{
$this->configure();

Expand Down
2 changes: 1 addition & 1 deletion src/Knp/Snappy/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Image extends AbstractGenerator
/**
* {@inheritdoc}
*/
public function __construct($binary = null, array $options = [], array $env = null)
public function __construct($binary = null, array $options = [], array|null $env = null)
{
$this->setDefaultExtension('jpg');

Expand Down
2 changes: 1 addition & 1 deletion src/Knp/Snappy/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Pdf extends AbstractGenerator
/**
* {@inheritdoc}
*/
public function __construct($binary = null, array $options = [], array $env = null)
public function __construct($binary = null, array $options = [], array|null $env = null)
{
$this->setDefaultExtension('pdf');
$this->setOptionsWithContentCheck();
Expand Down
7 changes: 4 additions & 3 deletions tests/Knp/Snappy/PdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
namespace Tests\Knp\Snappy;

use Knp\Snappy\Pdf;
use PHPUnit\Framework\Error\Error;
use PHPUnit\Framework\TestCase;
use RecursiveDirectoryIterator;
use FilesystemIterator;
use CallbackFilterIterator;
use DirectoryIterator;
use ReflectionMethod;
use RuntimeException;

class PdfTest extends TestCase
{
Expand Down Expand Up @@ -79,8 +79,9 @@ public function testRemovesLocalFilesOnError(): void
$method->setAccessible(true);
$method->invoke($pdf, 'test', $pdf->getDefaultExtension());
$this->assertEquals(1, \count($pdf->temporaryFiles));
$this->expectException(Error::class);
\trigger_error('test error', \E_USER_ERROR);
$this->expectException(RuntimeException::class);

throw new RuntimeException('test error.');
// @phpstan-ignore-next-line See https://github.com/phpstan/phpstan/issues/7799
$this->assertFileNotExists(\reset($pdf->temporaryFiles));
}
Expand Down