Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@ public function processLongArgument($arg, $pos)
* @param string $argument The name of the argument which is being processed.
*
* @return array<string>
* @throws DeepExitException When any of the provided codes are not valid as sniff codes.
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException When any of the provided codes are not valid as sniff codes.
*/
private function parseSniffCodes($input, $argument)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Util/MessageCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function display($order=self::ORDERBY_SEVERITY)
*
* @return array<array<string, string|int>>
*/
private function prefixAll($messages)
private function prefixAll(array $messages)
{
foreach ($messages as $i => $details) {
$messages[$i]['message'] = $this->prefix($details['message'], $details['type']);
Expand Down Expand Up @@ -230,7 +230,7 @@ private function prefix($message, $type)
*
* @return array<string> A single dimensional array of only messages, sorted by severity.
*/
private function sortBySeverity($messages)
private function sortBySeverity(array $messages)
{
if (count($messages) === 1) {
return [$messages[0]['message']];
Expand Down
3 changes: 1 addition & 2 deletions tests/Core/Standards/StandardRulesetsQATest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
/**
* Tests that pre-defined standards do not throw errors.
*
* @author Juliette Reinders Folmer <[email protected]>
* @copyright 2025 Juliette Reinders Folmer. All rights reserved.
* @copyright 2025 PHPCSStandards and contributors
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Tests the conversion of parentheses tokens to type parentheses tokens.
* Tests the parenthesis indexes get set correctly.
*
* @author Juliette Reinders Folmer <[email protected]>
* @copyright 2024 PHPCSStandards and contributors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Tests converting enum "case" to T_ENUM_CASE.
* Tests that switch "case" statements get scope indexes, while enum "case" statements do not.
*
* @author Jaroslav Hanslík <[email protected]>
* @copyright 2021 Squiz Pty Ltd (ABN 77 084 670 600)
Expand All @@ -16,7 +16,7 @@ final class RecurseScopeMapCaseKeywordConditionsTest extends AbstractTokenizerTe


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


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


/**
* Test that "case" that is not enum case is still tokenized as `T_CASE`.
* Test that a "case" keyword which is not a switch or enum case, does not get the scope indexes.
*
* @param string $testMarker The comment which prefaces the target token in the test file.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
/**
* Tests the retokenization of the `default` keyword to T_MATCH_DEFAULT for PHP 8.0 match structures
* and makes sure that the tokenization of switch `T_DEFAULT` structures is not aversely affected.
* Tests that switch "default" statements get scope indexes, while match "default" statements do not.
*
* @author Juliette Reinders Folmer <[email protected]>
* @copyright 2020-2021 Squiz Pty Ltd (ABN 77 084 670 600)
Expand All @@ -17,7 +16,7 @@ final class RecurseScopeMapDefaultKeywordConditionsTest extends AbstractTokenize


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


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


/**
* Verify that the retokenization of `T_DEFAULT` tokens in match constructs, doesn't negatively
* impact the tokenization of `T_STRING` tokens with the contents 'default' which aren't in
* actual fact the default keyword.
* Test that a "default" keyword which is not a switch or match default, does not get the scope indexes.
*
* @param string $testMarker The comment prefacing the target token.
* @param string $testContent The token content to look for.
Expand Down
1 change: 0 additions & 1 deletion tests/Core/Util/MessageCollector/MessageCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/**
* Tests the message collecting functionality.
*
* @author Juliette Reinders Folmer <[email protected]>
* @copyright 2025 PHPCSStandards and contributors
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Util/Tokens/GetHighestWeightedTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testGetHighestWeightedToken($tokens, $expected)
/**
* Data provider.
*
* @return array<string, array<string, int|false|array<int|string>>
* @return array<string, array<string, int|false|array<int|string>>>
*/
public static function dataGetHighestWeightedToken()
{
Expand Down