From 37595a9bb62c3c25969bdd9e8d7dd24c3ac62bc9 Mon Sep 17 00:00:00 2001 From: JakeQZ Date: Tue, 6 Apr 2021 09:18:22 +0100 Subject: [PATCH] [CLEANUP] Use self:: to access class constants (#966) ...rather than `static::`. Constants are by definition not intended to be overridden. This also clears up the `MixedOperand` issues reported by Psalm for the affected code. --- psalm.baseline.xml | 8 -------- src/HtmlProcessor/AbstractHtmlProcessor.php | 12 ++++++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/psalm.baseline.xml b/psalm.baseline.xml index 803f24c7..92ad1948 100644 --- a/psalm.baseline.xml +++ b/psalm.baseline.xml @@ -82,14 +82,6 @@ - - static::CONTENT_TYPE_META_TAG - static::CONTENT_TYPE_META_TAG - static::CONTENT_TYPE_META_TAG - static::DEFAULT_DOCUMENT_TYPE - static::PHP_UNRECOGNIZED_VOID_TAGNAME_MATCHER - static::PHP_UNRECOGNIZED_VOID_TAGNAME_MATCHER - null diff --git a/src/HtmlProcessor/AbstractHtmlProcessor.php b/src/HtmlProcessor/AbstractHtmlProcessor.php index 85e27d26..300d1717 100644 --- a/src/HtmlProcessor/AbstractHtmlProcessor.php +++ b/src/HtmlProcessor/AbstractHtmlProcessor.php @@ -187,7 +187,7 @@ public function renderBodyContent(): string */ private function removeSelfClosingTagsClosingTags(string $html): string { - return \preg_replace('%%', '', $html); + return \preg_replace('%%', '', $html); } /** @@ -263,7 +263,7 @@ private function ensureDocumentType(string $html): string return $this->normalizeDocumentType($html); } - return static::DEFAULT_DOCUMENT_TYPE . $html; + return self::DEFAULT_DOCUMENT_TYPE . $html; } /** @@ -307,17 +307,17 @@ private function addContentTypeMetaTag(string $html): string if ($hasHeadTag) { $reworkedHtml = \preg_replace( '/])([^>]*+)>/i', - '' . static::CONTENT_TYPE_META_TAG, + '' . self::CONTENT_TYPE_META_TAG, $html ); } elseif ($hasHtmlTag) { $reworkedHtml = \preg_replace( '//i', - '' . static::CONTENT_TYPE_META_TAG . '', + '' . self::CONTENT_TYPE_META_TAG . '', $html ); } else { - $reworkedHtml = static::CONTENT_TYPE_META_TAG . $html; + $reworkedHtml = self::CONTENT_TYPE_META_TAG . $html; } return $reworkedHtml; @@ -430,7 +430,7 @@ private function removeHtmlTemplateElements(string $html): string private function ensurePhpUnrecognizedSelfClosingTagsAreXml(string $html): string { return \preg_replace( - '%<' . static::PHP_UNRECOGNIZED_VOID_TAGNAME_MATCHER . '\\b[^>]*+(?)%', + '%<' . self::PHP_UNRECOGNIZED_VOID_TAGNAME_MATCHER . '\\b[^>]*+(?)%', '$0/', $html );