Skip to content

Commit cd8fa35

Browse files
committed
Eliminate Some Annotations
I had been overriding some "false positive" Scrutinizer messages with annotations. Seeing if an alternate approach also works.
1 parent 5c33782 commit cd8fa35

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

src/PhpWord/Writer/HTML/Element/AbstractElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ abstract class AbstractElement
5050
protected $withoutP = false;
5151

5252
/**
53-
* @var \Zend\Escaper\Escaper|\PhpOffice\PhpWord\Escaper\AbstractEscaper
53+
* @var \Zend\Escaper\Escaper
5454
*/
5555
protected $escaper;
5656

src/PhpWord/Writer/HTML/Element/Text.php

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ public function write()
7676
$content .= $this->openingText;
7777
$content .= $this->openingTags;
7878
if (Settings::isOutputEscapingEnabled()) {
79-
// Scrutinizer notes that escapeHTML does not exist on AbstractEscaper.
80-
// Nevertheless, it does exist for HTML writer.
8179
$escaper = $this->escaper;
82-
/** @scrutinizer ignore-call */
8380
$contenx = $escaper->escapeHtml($element->getText());
8481
} else {
8582
$contenx = $element->getText();
@@ -124,10 +121,7 @@ protected function writeOpening()
124121
{
125122
$content = '';
126123
if (!$this->withoutP) {
127-
$style = '';
128-
if (method_exists($this->element, 'getParagraphStyle')) {
129-
$style = $this->getParagraphStyle();
130-
}
124+
$style = $this->getParagraphStyle();
131125
$content .= "<p{$style}>";
132126
}
133127

@@ -151,10 +145,7 @@ protected function writeClosing()
151145

152146
if (!$this->withoutP) {
153147
if (Settings::isOutputEscapingEnabled()) {
154-
// Scrutinizer notes that escapeHTML does not exist on AbstractEscaper.
155-
// Nevertheless, it does exist for HTML writer.
156148
$escaper = $this->escaper;
157-
/** @scrutinizer ignore-call */
158149
$contenx = $escaper->escapeHtml($this->closingText);
159150
$content .= $contenx;
160151
} else {
@@ -275,12 +266,10 @@ private function getFontStyle()
275266
$lang = $fontStyle->getLang();
276267
} elseif (!empty($fontStyle)) {
277268
$style = " class=\"$fontStyle\"";
278-
$styl2 = Style::getStyle($fontStyle);
279-
if (!empty($styl2)) {
280-
// Scrutinizer notes that getLang does not exist on Abstract Style.
281-
// Nevertheless, it does exist for Font Style.
282-
/** @scrutinizer ignore-call */
283-
$lang = $styl2->getLang();
269+
/** @var \PhpOffice\PhpWord\Style\Font $styl3 Type hint */
270+
$styl3 = Style::getStyle($fontStyle);
271+
if (!empty($styl3)) {
272+
$lang = $styl3->getLang();
284273
}
285274
}
286275
if ($lang) {

0 commit comments

Comments
 (0)