Skip to content

Commit b5f4c2a

Browse files
committed
Pdf Improvements
1 parent 29cfaaf commit b5f4c2a

File tree

22 files changed

+136
-292
lines changed

22 files changed

+136
-292
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,11 @@ parameters:
1010
count: 1
1111
path: src/PhpWord/Element/AbstractContainer.php
1212

13-
-
14-
message: "#^Parameter \\#2 \\$styleValue of method PhpOffice\\\\PhpWord\\\\Element\\\\AbstractElement\\:\\:setNewStyle\\(\\) expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, array\\|PhpOffice\\\\PhpWord\\\\Style\\\\Cell\\|null given\\.$#"
15-
count: 1
16-
path: src/PhpWord/Element/Cell.php
17-
1813
-
1914
message: "#^Property PhpOffice\\\\PhpWord\\\\Element\\\\Field\\:\\:\\$fontStyle \\(PhpOffice\\\\PhpWord\\\\Style\\\\Font\\|string\\) does not accept null\\.$#"
2015
count: 1
2116
path: src/PhpWord/Element/Field.php
2217

23-
-
24-
message: "#^Parameter \\#2 \\$styleValue of method PhpOffice\\\\PhpWord\\\\Element\\\\AbstractElement\\:\\:setNewStyle\\(\\) expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, array\\|PhpOffice\\\\PhpWord\\\\Style\\\\Paragraph\\|string\\|null given\\.$#"
25-
count: 1
26-
path: src/PhpWord/Element/Footnote.php
27-
2818
-
2919
message: "#^Method PhpOffice\\\\PhpWord\\\\Element\\\\Image\\:\\:getArchiveImageSize\\(\\) should return array\\|null but returns array<int\\|string, int\\|string>\\|false\\|null\\.$#"
3020
count: 1
@@ -60,11 +50,6 @@ parameters:
6050
count: 1
6151
path: src/PhpWord/Element/Section.php
6252

63-
-
64-
message: "#^Parameter \\#2 \\$styleValue of method PhpOffice\\\\PhpWord\\\\Element\\\\AbstractElement\\:\\:setNewStyle\\(\\) expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, array\\|PhpOffice\\\\PhpWord\\\\Style\\|PhpOffice\\\\PhpWord\\\\Style\\\\Section\\|string given\\.$#"
65-
count: 1
66-
path: src/PhpWord/Element/Section.php
67-
6853
-
6954
message: "#^Method PhpOffice\\\\PhpWord\\\\Escaper\\\\Rtf\\:\\:escapeAsciiCharacter\\(\\) has parameter \\$code with no type specified\\.$#"
7055
count: 1
@@ -1205,11 +1190,6 @@ parameters:
12051190
count: 1
12061191
path: tests/PhpWordTests/Element/ImageTest.php
12071192

1208-
-
1209-
message: "#^Parameter \\#2 \\$style of class PhpOffice\\\\PhpWord\\\\Element\\\\Section constructor expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, PhpOffice\\\\PhpWord\\\\Style\\\\Section given\\.$#"
1210-
count: 1
1211-
path: tests/PhpWordTests/Element/SectionTest.php
1212-
12131193
-
12141194
message: "#^Parameter \\#1 \\$text of class PhpOffice\\\\PhpWord\\\\Element\\\\Title constructor expects PhpOffice\\\\PhpWord\\\\Element\\\\TextRun\\|string, PhpOffice\\\\PhpWord\\\\Element\\\\PageBreak given\\.$#"
12151195
count: 1
@@ -1485,56 +1465,6 @@ parameters:
14851465
count: 1
14861466
path: tests/PhpWordTests/Writer/ODText/Style/FontTest.php
14871467

1488-
-
1489-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getFont\\(\\)\\.$#"
1490-
count: 2
1491-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1492-
1493-
-
1494-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getOrientation\\(\\)\\.$#"
1495-
count: 1
1496-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1497-
1498-
-
1499-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getPaperSize\\(\\)\\.$#"
1500-
count: 1
1501-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1502-
1503-
-
1504-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getTempDir\\(\\)\\.$#"
1505-
count: 1
1506-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1507-
1508-
-
1509-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setFont\\(\\)\\.$#"
1510-
count: 1
1511-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1512-
1513-
-
1514-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setOrientation\\(\\)\\.$#"
1515-
count: 1
1516-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1517-
1518-
-
1519-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setPaperSize\\(\\)\\.$#"
1520-
count: 1
1521-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1522-
1523-
-
1524-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setTempDir\\(\\)\\.$#"
1525-
count: 1
1526-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1527-
1528-
-
1529-
message: "#^Parameter \\#2 \\$libraryBaseDir of static method PhpOffice\\\\PhpWord\\\\Settings\\:\\:setPdfRenderer\\(\\) expects string, string\\|false given\\.$#"
1530-
count: 3
1531-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1532-
1533-
-
1534-
message: "#^Parameter \\#2 \\$libraryBaseDir of static method PhpOffice\\\\PhpWord\\\\Settings\\:\\:setPdfRenderer\\(\\) expects string, string\\|false given\\.$#"
1535-
count: 1
1536-
path: tests/PhpWordTests/Writer/PDFTest.php
1537-
15381468
-
15391469
message: "#^Method PhpOffice\\\\PhpWordTests\\\\Writer\\\\RTF\\\\ElementTest\\:\\:removeCr\\(\\) has no return type specified\\.$#"
15401470
count: 1

phpstan-baseline.php7.neon

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,11 @@ parameters:
55
count: 1
66
path: src/PhpWord/Element/AbstractContainer.php
77

8-
-
9-
message: "#^Parameter \\#2 \\$styleValue of method PhpOffice\\\\PhpWord\\\\Element\\\\AbstractElement\\:\\:setNewStyle\\(\\) expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, array\\|PhpOffice\\\\PhpWord\\\\Style\\\\Cell\\|null given\\.$#"
10-
count: 1
11-
path: src/PhpWord/Element/Cell.php
12-
138
-
149
message: "#^Property PhpOffice\\\\PhpWord\\\\Element\\\\Field\\:\\:\\$fontStyle \\(PhpOffice\\\\PhpWord\\\\Style\\\\Font\\|string\\) does not accept null\\.$#"
1510
count: 1
1611
path: src/PhpWord/Element/Field.php
1712

18-
-
19-
message: "#^Parameter \\#2 \\$styleValue of method PhpOffice\\\\PhpWord\\\\Element\\\\AbstractElement\\:\\:setNewStyle\\(\\) expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, array\\|PhpOffice\\\\PhpWord\\\\Style\\\\Paragraph\\|string\\|null given\\.$#"
20-
count: 1
21-
path: src/PhpWord/Element/Footnote.php
22-
2313
-
2414
message: "#^Method PhpOffice\\\\PhpWord\\\\Element\\\\Image\\:\\:getArchiveImageSize\\(\\) should return array\\|null but returns array<int\\|string, int\\|string>\\|false\\|null\\.$#"
2515
count: 1
@@ -50,11 +40,6 @@ parameters:
5040
count: 1
5141
path: src/PhpWord/Element/Section.php
5242

53-
-
54-
message: "#^Parameter \\#2 \\$styleValue of method PhpOffice\\\\PhpWord\\\\Element\\\\AbstractElement\\:\\:setNewStyle\\(\\) expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, array\\|PhpOffice\\\\PhpWord\\\\Style\\|PhpOffice\\\\PhpWord\\\\Style\\\\Section\\|string given\\.$#"
55-
count: 1
56-
path: src/PhpWord/Element/Section.php
57-
5843
-
5944
message: "#^Method PhpOffice\\\\PhpWord\\\\Escaper\\\\Rtf\\:\\:escapeAsciiCharacter\\(\\) has parameter \\$code with no type specified\\.$#"
6045
count: 1
@@ -1180,11 +1165,6 @@ parameters:
11801165
count: 1
11811166
path: tests/PhpWordTests/Element/ImageTest.php
11821167

1183-
-
1184-
message: "#^Parameter \\#2 \\$style of class PhpOffice\\\\PhpWord\\\\Element\\\\Section constructor expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, PhpOffice\\\\PhpWord\\\\Style\\\\Section given\\.$#"
1185-
count: 1
1186-
path: tests/PhpWordTests/Element/SectionTest.php
1187-
11881168
-
11891169
message: "#^Parameter \\#1 \\$text of class PhpOffice\\\\PhpWord\\\\Element\\\\Title constructor expects PhpOffice\\\\PhpWord\\\\Element\\\\TextRun\\|string, PhpOffice\\\\PhpWord\\\\Element\\\\PageBreak given\\.$#"
11901170
count: 1
@@ -1455,56 +1435,6 @@ parameters:
14551435
count: 1
14561436
path: tests/PhpWordTests/Writer/ODText/Style/FontTest.php
14571437

1458-
-
1459-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getFont\\(\\)\\.$#"
1460-
count: 2
1461-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1462-
1463-
-
1464-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getOrientation\\(\\)\\.$#"
1465-
count: 1
1466-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1467-
1468-
-
1469-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getPaperSize\\(\\)\\.$#"
1470-
count: 1
1471-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1472-
1473-
-
1474-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getTempDir\\(\\)\\.$#"
1475-
count: 1
1476-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1477-
1478-
-
1479-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setFont\\(\\)\\.$#"
1480-
count: 1
1481-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1482-
1483-
-
1484-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setOrientation\\(\\)\\.$#"
1485-
count: 1
1486-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1487-
1488-
-
1489-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setPaperSize\\(\\)\\.$#"
1490-
count: 1
1491-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1492-
1493-
-
1494-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setTempDir\\(\\)\\.$#"
1495-
count: 1
1496-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1497-
1498-
-
1499-
message: "#^Parameter \\#2 \\$libraryBaseDir of static method PhpOffice\\\\PhpWord\\\\Settings\\:\\:setPdfRenderer\\(\\) expects string, string\\|false given\\.$#"
1500-
count: 3
1501-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1502-
1503-
-
1504-
message: "#^Parameter \\#2 \\$libraryBaseDir of static method PhpOffice\\\\PhpWord\\\\Settings\\:\\:setPdfRenderer\\(\\) expects string, string\\|false given\\.$#"
1505-
count: 1
1506-
path: tests/PhpWordTests/Writer/PDFTest.php
1507-
15081438
-
15091439
message: "#^Method PhpOffice\\\\PhpWordTests\\\\Writer\\\\RTF\\\\ElementTest\\:\\:removeCr\\(\\) has no return type specified\\.$#"
15101440
count: 1

phpstan-baseline.php73.neon

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,11 @@ parameters:
55
count: 1
66
path: src/PhpWord/Element/AbstractContainer.php
77

8-
-
9-
message: "#^Parameter \\#2 \\$styleValue of method PhpOffice\\\\PhpWord\\\\Element\\\\AbstractElement\\:\\:setNewStyle\\(\\) expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, array\\|PhpOffice\\\\PhpWord\\\\Style\\\\Cell\\|null given\\.$#"
10-
count: 1
11-
path: src/PhpWord/Element/Cell.php
12-
138
-
149
message: "#^Property PhpOffice\\\\PhpWord\\\\Element\\\\Field\\:\\:\\$fontStyle \\(PhpOffice\\\\PhpWord\\\\Style\\\\Font\\|string\\) does not accept null\\.$#"
1510
count: 1
1611
path: src/PhpWord/Element/Field.php
1712

18-
-
19-
message: "#^Parameter \\#2 \\$styleValue of method PhpOffice\\\\PhpWord\\\\Element\\\\AbstractElement\\:\\:setNewStyle\\(\\) expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, array\\|PhpOffice\\\\PhpWord\\\\Style\\\\Paragraph\\|string\\|null given\\.$#"
20-
count: 1
21-
path: src/PhpWord/Element/Footnote.php
22-
2313
-
2414
message: "#^Method PhpOffice\\\\PhpWord\\\\Element\\\\Image\\:\\:getArchiveImageSize\\(\\) should return array\\|null but returns array<int\\|string, int\\|string>\\|false\\|null\\.$#"
2515
count: 1
@@ -50,11 +40,6 @@ parameters:
5040
count: 1
5141
path: src/PhpWord/Element/Section.php
5242

53-
-
54-
message: "#^Parameter \\#2 \\$styleValue of method PhpOffice\\\\PhpWord\\\\Element\\\\AbstractElement\\:\\:setNewStyle\\(\\) expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, array\\|PhpOffice\\\\PhpWord\\\\Style\\|PhpOffice\\\\PhpWord\\\\Style\\\\Section\\|string given\\.$#"
55-
count: 1
56-
path: src/PhpWord/Element/Section.php
57-
5843
-
5944
message: "#^Method PhpOffice\\\\PhpWord\\\\Escaper\\\\Rtf\\:\\:escapeAsciiCharacter\\(\\) has parameter \\$code with no type specified\\.$#"
6045
count: 1
@@ -1180,11 +1165,6 @@ parameters:
11801165
count: 1
11811166
path: tests/PhpWordTests/Element/ImageTest.php
11821167

1183-
-
1184-
message: "#^Parameter \\#2 \\$style of class PhpOffice\\\\PhpWord\\\\Element\\\\Section constructor expects array\\|PhpOffice\\\\PhpWord\\\\Style\\|string\\|null, PhpOffice\\\\PhpWord\\\\Style\\\\Section given\\.$#"
1185-
count: 1
1186-
path: tests/PhpWordTests/Element/SectionTest.php
1187-
11881168
-
11891169
message: "#^Parameter \\#1 \\$text of class PhpOffice\\\\PhpWord\\\\Element\\\\Title constructor expects PhpOffice\\\\PhpWord\\\\Element\\\\TextRun\\|string, PhpOffice\\\\PhpWord\\\\Element\\\\PageBreak given\\.$#"
11901170
count: 1
@@ -1455,56 +1435,6 @@ parameters:
14551435
count: 1
14561436
path: tests/PhpWordTests/Writer/ODText/Style/FontTest.php
14571437

1458-
-
1459-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getFont\\(\\)\\.$#"
1460-
count: 2
1461-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1462-
1463-
-
1464-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getOrientation\\(\\)\\.$#"
1465-
count: 1
1466-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1467-
1468-
-
1469-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getPaperSize\\(\\)\\.$#"
1470-
count: 1
1471-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1472-
1473-
-
1474-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:getTempDir\\(\\)\\.$#"
1475-
count: 1
1476-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1477-
1478-
-
1479-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setFont\\(\\)\\.$#"
1480-
count: 1
1481-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1482-
1483-
-
1484-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setOrientation\\(\\)\\.$#"
1485-
count: 1
1486-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1487-
1488-
-
1489-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setPaperSize\\(\\)\\.$#"
1490-
count: 1
1491-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1492-
1493-
-
1494-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Writer\\\\PDF\\:\\:setTempDir\\(\\)\\.$#"
1495-
count: 1
1496-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1497-
1498-
-
1499-
message: "#^Parameter \\#2 \\$libraryBaseDir of static method PhpOffice\\\\PhpWord\\\\Settings\\:\\:setPdfRenderer\\(\\) expects string, string\\|false given\\.$#"
1500-
count: 3
1501-
path: tests/PhpWordTests/Writer/PDF/DomPDFTest.php
1502-
1503-
-
1504-
message: "#^Parameter \\#2 \\$libraryBaseDir of static method PhpOffice\\\\PhpWord\\\\Settings\\:\\:setPdfRenderer\\(\\) expects string, string\\|false given\\.$#"
1505-
count: 1
1506-
path: tests/PhpWordTests/Writer/PDFTest.php
1507-
15081438
-
15091439
message: "#^Method PhpOffice\\\\PhpWordTests\\\\Writer\\\\RTF\\\\ElementTest\\:\\:removeCr\\(\\) has no return type specified\\.$#"
15101440
count: 1

src/PhpWord/Element/AbstractElement.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use PhpOffice\PhpWord\Media;
2525
use PhpOffice\PhpWord\PhpWord;
2626
use PhpOffice\PhpWord\Style;
27+
use PhpOffice\PhpWord\Style\AbstractStyle;
2728

2829
/**
2930
* Element abstract class.
@@ -481,7 +482,7 @@ public function isInSection()
481482
* Set new style value.
482483
*
483484
* @param mixed $styleObject Style object
484-
* @param null|array|string|Style $styleValue Style value
485+
* @param null|AbstractStyle|array|string $styleValue Style value
485486
* @param bool $returnObject Always return object
486487
*
487488
* @return mixed

src/PhpWord/Element/Section.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Section extends AbstractContainer
6161
* Create new instance.
6262
*
6363
* @param int $sectionCount
64-
* @param null|array|\PhpOffice\PhpWord\Style|string $style
64+
* @param null|array|SectionStyle|string $style
6565
*/
6666
public function __construct($sectionCount, $style = null)
6767
{

src/PhpWord/PhpWord.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use PhpOffice\PhpWord\Element\Section;
2323
use PhpOffice\PhpWord\Exception\Exception;
2424
use PhpOffice\PhpWord\Style\Font;
25+
use PhpOffice\PhpWord\Style\Section as StyleSection;
2526

2627
/**
2728
* PHPWord main class.
@@ -213,7 +214,7 @@ public function getSection($index)
213214
/**
214215
* Create new section.
215216
*
216-
* @param null|array|string $style
217+
* @param null|array|string|StyleSection $style
217218
*
218219
* @return Section
219220
*/

src/PhpWord/Writer/ODText/Element/Formula.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,11 @@ class Formula extends AbstractElement
3535
public function write(): void
3636
{
3737
$xmlWriter = $this->getXmlWriter();
38+
/** @var ElementFormula */
3839
$element = $this->getElement();
39-
if (!$element instanceof ElementFormula) {
40-
return;
41-
}
4240

41+
/** @var AbstractPart */
4342
$part = $this->getPart();
44-
if (!$part instanceof AbstractPart) {
45-
return;
46-
}
4743

4844
$objectIdx = $part->addObject($element);
4945

src/PhpWord/Writer/ODText/Element/ListItemRun.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ class ListItemRun extends AbstractElement
3232
*/
3333
public function write(): void
3434
{
35+
/** @var ListItemRunElement */
3536
$element = $this->getElement();
36-
if (!$element instanceof ListItemRunElement) {
37-
return;
38-
}
3937
$depth = $element->getDepth() + 1;
4038

4139
$xmlWriter = $this->getXmlWriter();

src/PhpWord/Writer/ODText/Element/Ruby.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ class Ruby extends AbstractElement
3535
public function write(): void
3636
{
3737
$xmlWriter = $this->getXmlWriter();
38+
/** @var \PhpOffice\PhpWord\Element\Ruby */
3839
$element = $this->getElement();
39-
if (!$element instanceof \PhpOffice\PhpWord\Element\Ruby) {
40-
return;
41-
}
4240
if (!$this->withoutP) {
4341
$xmlWriter->startElement('text:p'); // text:p
4442
}

0 commit comments

Comments
 (0)