Skip to content

Commit 21ba22c

Browse files
committed
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 14ff869 as these methods were changed in the earlier refactor.
1 parent 3988309 commit 21ba22c

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

src/Generators/HTML.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
use DOMDocument;
1919
use DOMElement;
20-
use DOMNode;
2120
use PHP_CodeSniffer\Config;
2221
use PHP_CodeSniffer\Exceptions\GeneratorException;
2322

@@ -318,14 +317,14 @@ private function titleToAnchor(string $title)
318317
/**
319318
* Format a text block found in a standard.
320319
*
321-
* @param \DOMNode $node The DOMNode object for the text block.
320+
* @param \DOMElement $node The DOMElement object for the text block.
322321
*
323322
* @since 3.12.0 Replaces the HTML::printTextBlock() method,
324323
* which was deprecated in 3.12.0 and removed in 4.0.0.
325324
*
326325
* @return string
327326
*/
328-
protected function getFormattedTextBlock(DOMNode $node)
327+
protected function getFormattedTextBlock(DOMElement $node)
329328
{
330329
$content = $node->nodeValue;
331330
if (empty($content) === true) {
@@ -370,14 +369,14 @@ protected function getFormattedTextBlock(DOMNode $node)
370369
/**
371370
* Format a code comparison block found in a standard.
372371
*
373-
* @param \DOMNode $node The DOMNode object for the code comparison block.
372+
* @param \DOMElement $node The DOMElement object for the code comparison block.
374373
*
375374
* @since 3.12.0 Replaces the HTML::printCodeComparisonBlock() method,
376375
* which was deprecated in 3.12.0 and removed in 4.0.0.
377376
*
378377
* @return string
379378
*/
380-
protected function getFormattedCodeComparisonBlock(DOMNode $node)
379+
protected function getFormattedCodeComparisonBlock(DOMElement $node)
381380
{
382381
$codeBlocks = $node->getElementsByTagName('code');
383382
$firstCodeElm = $codeBlocks->item(0);

src/Generators/Markdown.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace PHP_CodeSniffer\Generators;
1313

1414
use DOMElement;
15-
use DOMNode;
1615
use PHP_CodeSniffer\Config;
1716
use PHP_CodeSniffer\Exceptions\GeneratorException;
1817

@@ -125,14 +124,14 @@ protected function processSniff(DOMElement $doc)
125124
/**
126125
* Format a text block found in a standard.
127126
*
128-
* @param \DOMNode $node The DOMNode object for the text block.
127+
* @param \DOMElement $node The DOMElement object for the text block.
129128
*
130129
* @since 3.12.0 Replaces the Markdown::printTextBlock() method,
131130
* which was deprecated in 3.12.0 and removed in 4.0.0.
132131
*
133132
* @return string
134133
*/
135-
protected function getFormattedTextBlock(DOMNode $node)
134+
protected function getFormattedTextBlock(DOMElement $node)
136135
{
137136
$content = $node->nodeValue;
138137
if (empty($content) === true) {
@@ -175,14 +174,14 @@ protected function getFormattedTextBlock(DOMNode $node)
175174
/**
176175
* Format a code comparison block found in a standard.
177176
*
178-
* @param \DOMNode $node The DOMNode object for the code comparison block.
177+
* @param \DOMElement $node The DOMElement object for the code comparison block.
179178
*
180179
* @since 3.12.0 Replaces the Markdown::printCodeComparisonBlock() method,
181180
* which was deprecated in 3.12.0 and removed in 4.0.0.
182181
*
183182
* @return string
184183
*/
185-
protected function getFormattedCodeComparisonBlock(DOMNode $node)
184+
protected function getFormattedCodeComparisonBlock(DOMElement $node)
186185
{
187186
$codeBlocks = $node->getElementsByTagName('code');
188187
$firstCodeElm = $codeBlocks->item(0);

src/Generators/Text.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
namespace PHP_CodeSniffer\Generators;
1515

1616
use DOMElement;
17-
use DOMNode;
1817

1918
class Text extends Generator
2019
{
@@ -78,14 +77,14 @@ protected function getFormattedTitle(DOMElement $doc)
7877
/**
7978
* Format a text block found in a standard.
8079
*
81-
* @param \DOMNode $node The DOMNode object for the text block.
80+
* @param \DOMElement $node The DOMElement object for the text block.
8281
*
8382
* @since 3.12.0 Replaces the Text::printTextBlock() method,
8483
* which was deprecated in 3.12.0 and removed in 4.0.0.
8584
*
8685
* @return string
8786
*/
88-
protected function getFormattedTextBlock(DOMNode $node)
87+
protected function getFormattedTextBlock(DOMElement $node)
8988
{
9089
$text = $node->nodeValue;
9190
if (empty($text) === true) {
@@ -106,14 +105,14 @@ protected function getFormattedTextBlock(DOMNode $node)
106105
/**
107106
* Format a code comparison block found in a standard.
108107
*
109-
* @param \DOMNode $node The DOMNode object for the code comparison block.
108+
* @param \DOMElement $node The DOMElement object for the code comparison block.
110109
*
111110
* @since 3.12.0 Replaces the Text::printCodeComparisonBlock() method,
112111
* which was deprecated in 3.12.0 and removed in 4.0.0.
113112
*
114113
* @return string
115114
*/
116-
protected function getFormattedCodeComparisonBlock(DOMNode $node)
115+
protected function getFormattedCodeComparisonBlock(DOMElement $node)
117116
{
118117
$codeBlocks = $node->getElementsByTagName('code');
119118
$firstCodeElm = $codeBlocks->item(0);

0 commit comments

Comments
 (0)