From b6e1a5c91a0999a13eda4207fc23ff495637d697 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 6 Feb 2021 17:19:07 +0300 Subject: fix several warnings reported by phpstan --- classes/sanitizer.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'classes/sanitizer.php') diff --git a/classes/sanitizer.php b/classes/sanitizer.php index 9ca4200a5..5a054c3b0 100644 --- a/classes/sanitizer.php +++ b/classes/sanitizer.php @@ -188,16 +188,16 @@ class Sanitizer { $text = $child->textContent; while (($pos = mb_stripos($text, $word)) !== false) { - $fragment->appendChild(new DomText(mb_substr($text, 0, $pos))); - $word = mb_substr($text, $pos, mb_strlen($word)); + $fragment->appendChild(new DOMText(mb_substr($text, 0, (int)$pos))); + $word = mb_substr($text, (int)$pos, mb_strlen($word)); $highlight = $doc->createElement('span'); - $highlight->appendChild(new DomText($word)); + $highlight->appendChild(new DOMText($word)); $highlight->setAttribute('class', 'highlight'); $fragment->appendChild($highlight); $text = mb_substr($text, $pos + mb_strlen($word)); } - if (!empty($text)) $fragment->appendChild(new DomText($text)); + if (!empty($text)) $fragment->appendChild(new DOMText($text)); $child->parentNode->replaceChild($fragment, $child); } -- cgit v1.2.3