Skip to content

Commit cbda0b6

Browse files
committed
Avoid Php8.5 Deprecations
1 parent 3efc30e commit cbda0b6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/PhpWord/Writer/ODText/Style/Font.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ private function writeStyle(FontStyle $style): void
8888
$xmlWriter->writeAttributeIf(is_numeric($size), 'style:font-size-complex', $size . 'pt');
8989

9090
// Color
91-
$color = $style->getColor();
92-
$xmlWriter->writeAttributeIf($color != '', 'fo:color', '#' . \PhpOffice\PhpWord\Shared\Converter::stringToRgb($color));
91+
$color = (string) $style->getColor();
92+
$xmlWriter->writeAttributeIf($color !== '', 'fo:color', '#' . \PhpOffice\PhpWord\Shared\Converter::stringToRgb($color));
9393

9494
// Bold & italic
9595
$xmlWriter->writeAttributeIf($style->isBold(), 'fo:font-weight', 'bold');
@@ -133,8 +133,8 @@ private function writeStyle(FontStyle $style): void
133133
}
134134

135135
// Foreground-Color (which is really background color)
136-
$fgColor = $style->getFgColor();
137-
$xmlWriter->writeAttributeIf($fgColor != '', 'fo:background-color', '#' . \PhpOffice\PhpWord\Shared\Converter::stringToRgb($fgColor));
136+
$fgColor = (string) $style->getFgColor();
137+
$xmlWriter->writeAttributeIf($fgColor !== '', 'fo:background-color', '#' . \PhpOffice\PhpWord\Shared\Converter::stringToRgb($fgColor));
138138

139139
$xmlWriter->endElement(); // style:text-properties
140140
$xmlWriter->endElement(); // style:style

0 commit comments

Comments
 (0)