Skip to content

Commit 882f98f

Browse files
committed
Tweak
1 parent 8545130 commit 882f98f

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,9 +1404,3 @@ parameters:
14041404
message: "#^Property PhpOffice\\\\PhpWordTests\\\\XmlDocument\\:\\:\\$xpath \\(DOMXPath\\) does not accept null\\.$#"
14051405
count: 1
14061406
path: tests/PhpWordTests/XmlDocument.php
1407-
1408-
# https://github.com/phpstan/phpstan/issues/8770
1409-
-
1410-
message: "#^PHPDoc tag @var with type PhpOffice\\\\PhpWord\\\\Writer\\\\HTML\\\\Part\\\\AbstractPart is not subtype of native type[\\sA-Za-z\\@\\\\\\/0-9\\.:|]+$#"
1411-
count: 1
1412-
path: src/PhpWord/Writer/HTML.php

src/PhpWord/Writer/HTML.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use PhpOffice\PhpWord\PhpWord;
2222
use PhpOffice\PhpWord\Settings;
2323
use PhpOffice\PhpWord\Shared\Validate;
24-
use PhpOffice\PhpWord\Writer\HTML\Part\AbstractPart;
2524

2625
/**
2726
* HTML writer.
@@ -77,8 +76,7 @@ public function __construct(?PhpWord $phpWord = null)
7776
$this->parts = ['Head', 'Body'];
7877
foreach ($this->parts as $partName) {
7978
$partClass = self::class . '\\Part\\' . $partName;
80-
if (class_exists($partClass)) {
81-
/** @var AbstractPart $part Type hint */
79+
if (class_exists($partClass) && method_exists($partClass, 'setParentWriter')) {
8280
$part = new $partClass();
8381
$part->setParentWriter($this);
8482
$this->writerParts[strtolower($partName)] = $part;

0 commit comments

Comments
 (0)