Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: list over array in more places #7876

Merged
merged 19 commits into from
Mar 11, 2024
6 changes: 3 additions & 3 deletions src/Fixer/AbstractPhpUnitFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ final protected function getDocBlockIndex(Tokens $tokens, int $index): int
}

/**
* @param array<string> $preventingAnnotations
* @param list<string> $preventingAnnotations
*/
final protected function ensureIsDockBlockWithAnnotation(
Tokens $tokens,
Expand Down Expand Up @@ -115,7 +115,7 @@ private function createDocBlock(Tokens $tokens, int $docBlockIndex, string $anno
}

/**
* @param array<string> $preventingAnnotations
* @param list<string> $preventingAnnotations
*/
private function updateDocBlockIfNeeded(
Tokens $tokens,
Expand All @@ -137,7 +137,7 @@ private function updateDocBlockIfNeeded(
}

/**
* @return array<Line>
* @return list<Line>
*/
private function addInternalAnnotation(DocBlock $docBlock, Tokens $tokens, int $docBlockIndex, string $annotation): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/Alias/PowToExponentiationFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
}

/**
* @return array<int[]>
* @return list<array{int, int, int}>
*/
private function findPowCalls(Tokens $tokens): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/ArrayNotation/YieldFromArrayToYieldsFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
}

/**
* @return iterable<int, array<int>>
* @return iterable<int, array{int, int}>
*/
private function getYieldsFromToUnpack(Tokens $tokens): iterable
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/Casing/MagicConstantCasingFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private function getMagicConstants(): array
}

/**
* @return array<int>
* @return list<int>
*/
private function getMagicConstantTokens(): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/ClassNotation/NoPhp4ConstructorFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private function fixInfiniteRecursion(Tokens $tokens, int $start, int $end): voi
* @param int $startIndex function/method start index
* @param int $bodyIndex function/method body index
*
* @return array{array<array<array{int, string}|int|string>>, array{3: false}}
* @return array{list<list<array{int, string}|int|string>>, array{3: false}}
*/
private function getWrapperMethodSequence(Tokens $tokens, string $method, int $startIndex, int $bodyIndex): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/ClassNotation/OrderedClassElementsFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ private function getElements(Tokens $tokens, int $startIndex): array
}

/**
* @return array<string>|string type or array of type and name
* @return list<string>|string type or array of type and name
*/
private function detectElementType(Tokens $tokens, int $index)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Fixer/ClassNotation/OrderedTypesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ private function isTypeSortable(TypeAnalysis $type): bool
}

/**
* @return array{0: array<string|string[]>, 1: string}
* @return array{0: list<string|string[]>, 1: string}
*/
private function collectDisjunctiveNormalFormTypes(string $type): array
{
Expand Down Expand Up @@ -336,9 +336,9 @@ private function collectUnionOrIntersectionTypes(string $type): array
}

/**
* @param array<string|string[]> $types
* @param list<string|string[]> $types
*
* @return array<string|string[]>
* @return list<string|string[]>
*/
private function runTypesThroughSortingAlgorithm(array $types): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/ControlStructure/NoBreakCommentFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private function getStructureEnd(Tokens $tokens, int $position): int
}

/**
* @return array<int>
* @return list<int>
*/
private static function getParenthesisedStructureKinds(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private function isClosingLineWithMeaningfulContent(Tokens $tokens, int $index):
}

/**
* @param array<array<int>> $annotationPositions Pairs of begin and end indices of main annotations
* @param list<array{int, int}> $annotationPositions Pairs of begin and end indices of main annotations
*/
private function indentationCanBeFixed(Tokens $tokens, int $newLineTokenIndex, array $annotationPositions): bool
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/FunctionNotation/CombineNestedDirnameFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private function getDirnameInfo(Tokens $tokens, int $index, ?int $firstArgumentE
}

/**
* @param array<array{indices: list<int>, secondArgument?: int, levels: int, end: int}> $dirnameInfoArray
* @param list<array{indices: list<int>, secondArgument?: int, levels: int, end: int}> $dirnameInfoArray
*/
private function combineDirnames(Tokens $tokens, array $dirnameInfoArray): void
{
Expand Down
6 changes: 2 additions & 4 deletions src/Fixer/FunctionNotation/NoSpacesAfterFunctionNameFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,16 @@ private function fixFunctionCall(Tokens $tokens, int $index): void
}

/**
* @return array<list<int>|string>
* @return list<array{int}|string>
*/
private function getBraceAfterVariableKinds(): array
{
static $tokens = [
return [
')',
']',
[CT::T_DYNAMIC_VAR_BRACE_CLOSE],
[CT::T_ARRAY_INDEX_CURLY_BRACE_CLOSE],
];

return $tokens;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Fixer/LanguageConstruct/NoUnsetOnPropertyFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
}

/**
* @return array<array<string, bool|int>>
* @return list<array<string, bool|int>>
*/
private function getUnsetsInfo(Tokens $tokens, int $index): array
{
Expand Down Expand Up @@ -144,7 +144,7 @@ private function isProperty(Tokens $tokens, int $index, int $endIndex): bool
}

/**
* @param array<array<string, bool|int>> $unsetsInfo
* @param list<array<string, bool|int>> $unsetsInfo
*/
private function isAnyUnsetToTransform(array $unsetsInfo): bool
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/Operator/BinaryOperatorSpacesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ final class BinaryOperatorSpacesFixer extends AbstractFixer implements Configura
private int $currentLevel;

/**
* @var array<null|string>
* @var list<null|string>
*/
private static array $allowedValues = [
self::ALIGN,
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/Operator/OperatorLinebreakFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class OperatorLinebreakFixer extends AbstractFixer implements Configurable
private string $position = 'beginning';

/**
* @var array<array<int|string>|string>
* @var list<list<int|string>|string>
*/
private array $operators = [];

Expand Down
4 changes: 2 additions & 2 deletions tests/Console/ConfigurationResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public static function provideResolvePathCases(): iterable
}

/**
* @param array<string> $paths
* @param list<string> $paths
*
* @dataProvider provideRejectInvalidPathCases
*/
Expand Down Expand Up @@ -1284,7 +1284,7 @@ public static function provideDeprecatedFixerConfiguredCases(): iterable
*
* @group legacy
*
* @param array<string> $successors
* @param list<string> $successors
*/
public function testDeprecatedRuleSetConfigured(string $ruleSet, array $successors): void
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Tokenizer/Analyzer/FunctionsAnalyzerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testIsGlobalFunctionCall(string $code, array $indices): void
}

/**
* @return iterable<array{string, array<int>}>
* @return iterable<array{string, list<int>}>
*/
public static function provideIsGlobalFunctionCallCases(): iterable
{
Expand Down Expand Up @@ -284,7 +284,7 @@ public function testIsGlobalFunctionCallPre80(string $code, array $indices): voi
}

/**
* @return iterable<array{string, array<int>}>
* @return iterable<array{string, list<int>}>
*/
public static function provideIsGlobalFunctionCallPre80Cases(): iterable
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Tokenizer/Analyzer/GotoLabelAnalyzerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testGotoLabel(string $source, array $expectedTrue): void
}

/**
* @return iterable<array{string, array<int>}>
* @return iterable<array{string, list<int>}>
*/
public static function provideGotoLabelCases(): iterable
{
Expand Down Expand Up @@ -124,7 +124,7 @@ public function testGotoLabel80(string $source, array $expectedTrue): void
}

/**
* @return iterable<array{string, array<int>}>
* @return iterable<array{string, list<int>}>
*/
public static function provideGotoLabel80Cases(): iterable
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Tokenizer/Analyzer/SwitchAnalyzerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
final class SwitchAnalyzerTest extends TestCase
{
/**
* @param array<int> $indices
* @param list<int> $indices
*
* @dataProvider provideColonCases
*/
Expand All @@ -44,7 +44,7 @@ public function testColon(string $code, array $indices): void
}

/**
* @return iterable<array{string, array<int>}>
* @return iterable<array{string, list<int>}>
*/
public static function provideColonCases(): iterable
{
Expand Down