From 21ba22cdba46f0df2dcb3bcedd814467428bc342 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 14 Sep 2025 00:55:20 +0200 Subject: [PATCH] Generators: update a few more type declarations Follow up on 1237 and the PRs from the refactor of the Generator classes. These were missed in commit 14ff8698f2b74cb51b5e2bd187de2054590b2bd0 as these methods were changed in the earlier refactor. --- src/Generators/HTML.php | 9 ++++----- src/Generators/Markdown.php | 9 ++++----- src/Generators/Text.php | 9 ++++----- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/Generators/HTML.php b/src/Generators/HTML.php index 14b2c69fa3..e9cf85c359 100644 --- a/src/Generators/HTML.php +++ b/src/Generators/HTML.php @@ -17,7 +17,6 @@ use DOMDocument; use DOMElement; -use DOMNode; use PHP_CodeSniffer\Config; use PHP_CodeSniffer\Exceptions\GeneratorException; @@ -318,14 +317,14 @@ private function titleToAnchor(string $title) /** * Format a text block found in a standard. * - * @param \DOMNode $node The DOMNode object for the text block. + * @param \DOMElement $node The DOMElement object for the text block. * * @since 3.12.0 Replaces the HTML::printTextBlock() method, * which was deprecated in 3.12.0 and removed in 4.0.0. * * @return string */ - protected function getFormattedTextBlock(DOMNode $node) + protected function getFormattedTextBlock(DOMElement $node) { $content = $node->nodeValue; if (empty($content) === true) { @@ -370,14 +369,14 @@ protected function getFormattedTextBlock(DOMNode $node) /** * Format a code comparison block found in a standard. * - * @param \DOMNode $node The DOMNode object for the code comparison block. + * @param \DOMElement $node The DOMElement object for the code comparison block. * * @since 3.12.0 Replaces the HTML::printCodeComparisonBlock() method, * which was deprecated in 3.12.0 and removed in 4.0.0. * * @return string */ - protected function getFormattedCodeComparisonBlock(DOMNode $node) + protected function getFormattedCodeComparisonBlock(DOMElement $node) { $codeBlocks = $node->getElementsByTagName('code'); $firstCodeElm = $codeBlocks->item(0); diff --git a/src/Generators/Markdown.php b/src/Generators/Markdown.php index 4a82910743..c1e2a422de 100644 --- a/src/Generators/Markdown.php +++ b/src/Generators/Markdown.php @@ -12,7 +12,6 @@ namespace PHP_CodeSniffer\Generators; use DOMElement; -use DOMNode; use PHP_CodeSniffer\Config; use PHP_CodeSniffer\Exceptions\GeneratorException; @@ -125,14 +124,14 @@ protected function processSniff(DOMElement $doc) /** * Format a text block found in a standard. * - * @param \DOMNode $node The DOMNode object for the text block. + * @param \DOMElement $node The DOMElement object for the text block. * * @since 3.12.0 Replaces the Markdown::printTextBlock() method, * which was deprecated in 3.12.0 and removed in 4.0.0. * * @return string */ - protected function getFormattedTextBlock(DOMNode $node) + protected function getFormattedTextBlock(DOMElement $node) { $content = $node->nodeValue; if (empty($content) === true) { @@ -175,14 +174,14 @@ protected function getFormattedTextBlock(DOMNode $node) /** * Format a code comparison block found in a standard. * - * @param \DOMNode $node The DOMNode object for the code comparison block. + * @param \DOMElement $node The DOMElement object for the code comparison block. * * @since 3.12.0 Replaces the Markdown::printCodeComparisonBlock() method, * which was deprecated in 3.12.0 and removed in 4.0.0. * * @return string */ - protected function getFormattedCodeComparisonBlock(DOMNode $node) + protected function getFormattedCodeComparisonBlock(DOMElement $node) { $codeBlocks = $node->getElementsByTagName('code'); $firstCodeElm = $codeBlocks->item(0); diff --git a/src/Generators/Text.php b/src/Generators/Text.php index f902c9bd0b..6866d477c3 100644 --- a/src/Generators/Text.php +++ b/src/Generators/Text.php @@ -14,7 +14,6 @@ namespace PHP_CodeSniffer\Generators; use DOMElement; -use DOMNode; class Text extends Generator { @@ -78,14 +77,14 @@ protected function getFormattedTitle(DOMElement $doc) /** * Format a text block found in a standard. * - * @param \DOMNode $node The DOMNode object for the text block. + * @param \DOMElement $node The DOMElement object for the text block. * * @since 3.12.0 Replaces the Text::printTextBlock() method, * which was deprecated in 3.12.0 and removed in 4.0.0. * * @return string */ - protected function getFormattedTextBlock(DOMNode $node) + protected function getFormattedTextBlock(DOMElement $node) { $text = $node->nodeValue; if (empty($text) === true) { @@ -106,14 +105,14 @@ protected function getFormattedTextBlock(DOMNode $node) /** * Format a code comparison block found in a standard. * - * @param \DOMNode $node The DOMNode object for the code comparison block. + * @param \DOMElement $node The DOMElement object for the code comparison block. * * @since 3.12.0 Replaces the Text::printCodeComparisonBlock() method, * which was deprecated in 3.12.0 and removed in 4.0.0. * * @return string */ - protected function getFormattedCodeComparisonBlock(DOMNode $node) + protected function getFormattedCodeComparisonBlock(DOMElement $node) { $codeBlocks = $node->getElementsByTagName('code'); $firstCodeElm = $codeBlocks->item(0);