Skip to content

Commit c1bc347

Browse files
authored
Merge pull request #886 from PHPCSStandards/feature/minor-docs-fixes
Docs: various minor tweaks
2 parents 97e340e + 85628bd commit c1bc347

8 files changed

+14
-20
lines changed

src/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ public function processLongArgument($arg, $pos)
12991299
* @param string $argument The name of the argument which is being processed.
13001300
*
13011301
* @return array<string>
1302-
* @throws DeepExitException When any of the provided codes are not valid as sniff codes.
1302+
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException When any of the provided codes are not valid as sniff codes.
13031303
*/
13041304
private function parseSniffCodes($input, $argument)
13051305
{

src/Util/MessageCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function display($order=self::ORDERBY_SEVERITY)
179179
*
180180
* @return array<array<string, string|int>>
181181
*/
182-
private function prefixAll($messages)
182+
private function prefixAll(array $messages)
183183
{
184184
foreach ($messages as $i => $details) {
185185
$messages[$i]['message'] = $this->prefix($details['message'], $details['type']);
@@ -230,7 +230,7 @@ private function prefix($message, $type)
230230
*
231231
* @return array<string> A single dimensional array of only messages, sorted by severity.
232232
*/
233-
private function sortBySeverity($messages)
233+
private function sortBySeverity(array $messages)
234234
{
235235
if (count($messages) === 1) {
236236
return [$messages[0]['message']];

tests/Core/Standards/StandardRulesetsQATest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
/**
33
* Tests that pre-defined standards do not throw errors.
44
*
5-
* @author Juliette Reinders Folmer <[email protected]>
6-
* @copyright 2025 Juliette Reinders Folmer. All rights reserved.
5+
* @copyright 2025 PHPCSStandards and contributors
76
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
87
*/
98

tests/Core/Tokenizers/Tokenizer/CreateParenthesisNestingMapDNFTypesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Tests the conversion of parentheses tokens to type parentheses tokens.
3+
* Tests the parenthesis indexes get set correctly.
44
*
55
* @author Juliette Reinders Folmer <[email protected]>
66
* @copyright 2024 PHPCSStandards and contributors

tests/Core/Tokenizers/Tokenizer/RecurseScopeMapCaseKeywordConditionsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Tests converting enum "case" to T_ENUM_CASE.
3+
* Tests that switch "case" statements get scope indexes, while enum "case" statements do not.
44
*
55
* @author Jaroslav Hanslík <[email protected]>
66
* @copyright 2021 Squiz Pty Ltd (ABN 77 084 670 600)
@@ -16,7 +16,7 @@ final class RecurseScopeMapCaseKeywordConditionsTest extends AbstractTokenizerTe
1616

1717

1818
/**
19-
* Test that the enum "case" is converted to T_ENUM_CASE.
19+
* Test that enum "case" tokens does not get scope indexes.
2020
*
2121
* @param string $testMarker The comment which prefaces the target token in the test file.
2222
*
@@ -64,7 +64,7 @@ public static function dataEnumCases()
6464

6565

6666
/**
67-
* Test that "case" that is not enum case is still tokenized as `T_CASE`.
67+
* Test that switch "case" tokens do get the scope indexes.
6868
*
6969
* @param string $testMarker The comment which prefaces the target token in the test file.
7070
* @param array<string, int|string> $expectedTokens The expected token codes for the scope opener/closer.
@@ -221,7 +221,7 @@ public static function dataNotEnumCases()
221221

222222

223223
/**
224-
* Test that "case" that is not enum case is still tokenized as `T_CASE`.
224+
* Test that a "case" keyword which is not a switch or enum case, does not get the scope indexes.
225225
*
226226
* @param string $testMarker The comment which prefaces the target token in the test file.
227227
*

tests/Core/Tokenizers/Tokenizer/RecurseScopeMapDefaultKeywordConditionsTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22
/**
3-
* Tests the retokenization of the `default` keyword to T_MATCH_DEFAULT for PHP 8.0 match structures
4-
* and makes sure that the tokenization of switch `T_DEFAULT` structures is not aversely affected.
3+
* Tests that switch "default" statements get scope indexes, while match "default" statements do not.
54
*
65
* @author Juliette Reinders Folmer <[email protected]>
76
* @copyright 2020-2021 Squiz Pty Ltd (ABN 77 084 670 600)
@@ -17,7 +16,7 @@ final class RecurseScopeMapDefaultKeywordConditionsTest extends AbstractTokenize
1716

1817

1918
/**
20-
* Test the retokenization of the `default` keyword for match structure to `T_MATCH_DEFAULT`.
19+
* Test that match "default" tokens does not get scope indexes.
2120
*
2221
* Note: Cases and default structures within a match structure do *NOT* get case/default scope
2322
* conditions, in contrast to case and default structures in switch control structures.
@@ -103,8 +102,7 @@ public static function dataMatchDefault()
103102

104103

105104
/**
106-
* Verify that the retokenization of `T_DEFAULT` tokens in match constructs, doesn't negatively
107-
* impact the tokenization of `T_DEFAULT` tokens in switch control structures.
105+
* Test that switch "default" tokens do get the scope indexes.
108106
*
109107
* Note: Cases and default structures within a switch control structure *do* get case/default scope
110108
* conditions.
@@ -220,9 +218,7 @@ public static function dataSwitchDefault()
220218

221219

222220
/**
223-
* Verify that the retokenization of `T_DEFAULT` tokens in match constructs, doesn't negatively
224-
* impact the tokenization of `T_STRING` tokens with the contents 'default' which aren't in
225-
* actual fact the default keyword.
221+
* Test that a "default" keyword which is not a switch or match default, does not get the scope indexes.
226222
*
227223
* @param string $testMarker The comment prefacing the target token.
228224
* @param string $testContent The token content to look for.

tests/Core/Util/MessageCollector/MessageCollectorTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/**
33
* Tests the message collecting functionality.
44
*
5-
* @author Juliette Reinders Folmer <[email protected]>
65
* @copyright 2025 PHPCSStandards and contributors
76
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
87
*/

tests/Core/Util/Tokens/GetHighestWeightedTokenTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testGetHighestWeightedToken($tokens, $expected)
4141
/**
4242
* Data provider.
4343
*
44-
* @return array<string, array<string, int|false|array<int|string>>
44+
* @return array<string, array<string, int|false|array<int|string>>>
4545
*/
4646
public static function dataGetHighestWeightedToken()
4747
{

0 commit comments

Comments
 (0)