Skip to content

Commit 94df594

Browse files
committed
Upgrade Dompdf to 8.4-Compatible Version
1 parent f37b119 commit 94df594

File tree

4 files changed

+10
-39
lines changed

4 files changed

+10
-39
lines changed

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/PhpSpreadsheet/Helper/Sample.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use PhpOffice\PhpSpreadsheet\Spreadsheet;
1010
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
1111
use PhpOffice\PhpSpreadsheet\Writer\IWriter;
12-
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf;
1312
use RecursiveDirectoryIterator;
1413
use RecursiveIteratorIterator;
1514
use RecursiveRegexIterator;
@@ -129,11 +128,7 @@ public function write(Spreadsheet $spreadsheet, string $filename, array $writers
129128
$writerCallback($writer);
130129
}
131130
$callStartTime = microtime(true);
132-
if (PHP_VERSION_ID >= 80400 && $writer instanceof Dompdf) {
133-
@$writer->save($path);
134-
} else {
135-
$writer->save($path);
136-
}
131+
$writer->save($path);
137132
$this->logWrite($writer, $path, $callStartTime);
138133
if ($this->isCli() === false) {
139134
// @codeCoverageIgnoreStart

tests/PhpSpreadsheetTests/Functional/StreamTest.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
use PhpOffice\PhpSpreadsheet\Spreadsheet;
99
use PHPUnit\Framework\TestCase;
1010

11-
/**
12-
* Not clear that Dompdf will be Php8.4 compatible in time.
13-
* Run in separate process and add version test till it is ready.
14-
*
15-
* @runTestsInSeparateProcesses
16-
*/
1711
class StreamTest extends TestCase
1812
{
1913
public static function providerFormats(): array
@@ -48,11 +42,7 @@ public function testAllWritersCanWriteToStream(string $format): void
4842
} else {
4943
self::assertSame(0, $stat['size']);
5044

51-
if ($format === 'Dompdf' && PHP_VERSION_ID >= 80400) {
52-
@$writer->save($stream);
53-
} else {
54-
$writer->save($stream);
55-
}
45+
$writer->save($stream);
5646

5747
self::assertIsResource($stream, 'should not close the stream for further usage out of PhpSpreadsheet');
5848
$stat = fstat($stream);

tests/PhpSpreadsheetTests/Writer/Dompdf/PaperSizeArrayTest.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf;
1111
use PHPUnit\Framework\TestCase;
1212

13-
/**
14-
* Not clear that Dompdf will be Php8.4 compatible in time.
15-
* Run in separate process and add version test till it is ready.
16-
*
17-
* @runTestsInSeparateProcesses
18-
*/
1913
class PaperSizeArrayTest extends TestCase
2014
{
2115
private string $outfile = '';
@@ -42,11 +36,7 @@ public function testPaperSizeArray(): void
4236
$sheet->setCellValue('A7', 'Lorem Ipsum');
4337
$writer = new Dompdf($spreadsheet);
4438
$this->outfile = File::temporaryFilename();
45-
if (PHP_VERSION_ID >= 80400) { // hopefully temporary
46-
@$writer->save($this->outfile);
47-
} else {
48-
$writer->save($this->outfile);
49-
}
39+
$writer->save($this->outfile);
5040
$spreadsheet->disconnectWorksheets();
5141
unset($spreadsheet);
5242
$contents = file_get_contents($this->outfile);
@@ -66,11 +56,7 @@ public function testPaperSizeNotArray(): void
6656
$sheet->setCellValue('A7', 'Lorem Ipsum');
6757
$writer = new Dompdf($spreadsheet);
6858
$this->outfile = File::temporaryFilename();
69-
if (PHP_VERSION_ID >= 80400) { // hopefully temporary
70-
@$writer->save($this->outfile);
71-
} else {
72-
$writer->save($this->outfile);
73-
}
59+
$writer->save($this->outfile);
7460
$spreadsheet->disconnectWorksheets();
7561
unset($spreadsheet);
7662
$contents = file_get_contents($this->outfile);

0 commit comments

Comments
 (0)