Skip to content

Commit a06ef9e

Browse files
authored
Types array/list cleanup (#936)
1 parent 1adfc79 commit a06ef9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+94
-93
lines changed

.dev-tools/src/Fixer/OrderedClassElementsInternalFixer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ public function fix(\SplFileInfo $file, Tokens $tokens): void
8888
$index = $tokens->getNextTokenOfKind($index, ['{']);
8989
\assert(\is_int($index));
9090

91-
/** @var array<array<string>> $elements */
91+
/** @var list<list<string>> $elements */
9292
$elements = $this->orderedClassElementsFixerWrapper->getElements($tokens, $index);
9393

9494
if (\count($elements) === 0) {
9595
continue;
9696
}
9797

98-
/** @var array<array<string>> $elements */
98+
/** @var list<list<string>> $elements */
9999
$elements = $this->orderedClassElementsFixerWrapper->sortElements($elements);
100100
$sorted = $this->sortElements($elements);
101101

@@ -111,15 +111,15 @@ public function fix(\SplFileInfo $file, Tokens $tokens): void
111111
}
112112

113113
/**
114-
* @param array<array<string>> $elements
114+
* @param list<list<string>> $elements
115115
*/
116116
private function sortElements(array $elements): array
117117
{
118118
\usort(
119119
$elements,
120120
/**
121-
* @param array<string> $a
122-
* @param array<string> $b
121+
* @param array<string, string> $a
122+
* @param array<string, string> $b
123123
*/
124124
static function (array $a, array $b): int {
125125
if (

.dev-tools/src/Fixer/PriorityInternalFixer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function isRisky(): bool
5858

5959
public function fix(\SplFileInfo $file, Tokens $tokens): void
6060
{
61-
/** @var array<int> $indices */
61+
/** @var list<int> $indices */
6262
$indices = $tokens->findSequence([[\T_CLASS]]);
6363

6464
$classStartIndex = \key($indices);
@@ -74,7 +74,7 @@ public function fix(\SplFileInfo $file, Tokens $tokens): void
7474

7575
$endIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $startIndex);
7676

77-
/** @var array<int> $indices */
77+
/** @var list<int> $indices */
7878
$indices = $tokens->findSequence([[\T_PUBLIC], [\T_FUNCTION], [\T_STRING, 'getPriority']], $startIndex, $endIndex);
7979

8080
$sequencesStartIndex = \key($indices);

.dev-tools/src/Priority/PriorityCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
final class PriorityCollection
2222
{
23-
/** @var array<PriorityFixer> */
23+
/** @var list<PriorityFixer> */
2424
private $priorityFixers = [];
2525

2626
public static function create(): self

.dev-tools/src/Priority/PriorityFixer.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ final class PriorityFixer
1818
/** @var FixerInterface */
1919
private $fixer;
2020

21-
/** @var array<self> */
21+
/** @var list<self> */
2222
private $fixersToRunAfter = [];
2323

24-
/** @var array<self> */
24+
/** @var list<self> */
2525
private $fixersToRunBefore = [];
2626

2727
/** @var null|int */
@@ -63,15 +63,15 @@ public function getPriority(): int
6363
}
6464

6565
/**
66-
* @return array<string>
66+
* @return list<string>
6767
*/
6868
public function getFixerToRunAfterNames(): array
6969
{
7070
return $this->getFixerNames($this->fixersToRunAfter);
7171
}
7272

7373
/**
74-
* @return array<string>
74+
* @return list<string>
7575
*/
7676
public function getFixerToRunBeforeNames(): array
7777
{
@@ -105,9 +105,9 @@ public function calculatePriority(bool $requireAllRelationHavePriority): bool
105105
}
106106

107107
/**
108-
* @param array<self> $priorityFixers
108+
* @param list<self> $priorityFixers
109109
*
110-
* @return array<string>
110+
* @return list<string>
111111
*/
112112
private function getFixerNames(array $priorityFixers): array
113113
{

.dev-tools/src/Readme/ReadmeCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private function fixers(): string
215215
if ($option->getAllowedValues() !== null) {
216216
$allowed = \array_map(static fn (string $value): string => \sprintf('\'%s\'', $value), $option->getAllowedValues());
217217
} else {
218-
/** @var array<string> $allowed */
218+
/** @var list<string> $allowed */
219219
$allowed = $option->getAllowedTypes();
220220
}
221221
$output .= \sprintf(

src/Analyzer/Analysis/ConstructorAnalysis.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function getConstructorIndex(): int
3737
}
3838

3939
/**
40-
* @return array<string>
40+
* @return list<string>
4141
*/
4242
public function getConstructorParameterNames(): array
4343
{
@@ -183,7 +183,7 @@ private function getPropertyIndex(int $index, int $openBrace): ?int
183183
/**
184184
* @param array<int, string> $array
185185
*
186-
* @return array<int>
186+
* @return array<int, int>
187187
*/
188188
private function getDuplicatesIndices(array $array): array
189189
{

src/Analyzer/Analysis/DataProviderAnalysis.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ final class DataProviderAnalysis
2222
/** @var int */
2323
private $nameIndex;
2424

25-
/** @var array<int> */
25+
/** @var list<int> */
2626
private $usageIndices;
2727

2828
/**
29-
* @param array<int> $usageIndices
29+
* @param list<int> $usageIndices
3030
*/
3131
public function __construct(string $name, int $nameIndex, array $usageIndices)
3232
{
@@ -46,7 +46,7 @@ public function getNameIndex(): int
4646
}
4747

4848
/**
49-
* @return array<int>
49+
* @return list<int>
5050
*/
5151
public function getUsageIndices(): array
5252
{

src/Analyzer/Analysis/SwitchAnalysis.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ final class SwitchAnalysis
2222
/** @var int */
2323
private $casesEnd;
2424

25-
/** @var array<CaseAnalysis> */
25+
/** @var list<CaseAnalysis> */
2626
private $cases = [];
2727

2828
/**
29-
* @param array<CaseAnalysis> $cases
29+
* @param list<CaseAnalysis> $cases
3030
*/
3131
public function __construct(int $casesStart, int $casesEnd, array $cases)
3232
{
@@ -46,7 +46,7 @@ public function getCasesEnd(): int
4646
}
4747

4848
/**
49-
* @return array<CaseAnalysis>
49+
* @return list<CaseAnalysis>
5050
*/
5151
public function getCases(): array
5252
{

src/Analyzer/ArrayAnalyzer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
final class ArrayAnalyzer
2222
{
2323
/**
24-
* @return array<ArrayElementAnalysis>
24+
* @return list<ArrayElementAnalysis>
2525
*/
2626
public function getElements(Tokens $tokens, int $index): array
2727
{
@@ -52,7 +52,7 @@ public function getElements(Tokens $tokens, int $index): array
5252
}
5353

5454
/**
55-
* @return array<ArrayElementAnalysis>
55+
* @return list<ArrayElementAnalysis>
5656
*/
5757
private function getElementsForArrayContent(Tokens $tokens, int $startIndex, int $endIndex): array
5858
{

src/Analyzer/DataProviderAnalyzer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
final class DataProviderAnalyzer
2222
{
2323
/**
24-
* @return array<DataProviderAnalysis>
24+
* @return list<DataProviderAnalysis>
2525
*/
2626
public function getDataProviders(Tokens $tokens, int $startIndex, int $endIndex): array
2727
{
@@ -42,7 +42,7 @@ public function getDataProviders(Tokens $tokens, int $startIndex, int $endIndex)
4242

4343
Preg::matchAll('/@dataProvider\s+([a-zA-Z0-9._:-\\\\x7f-\xff]+)/', $tokens[$docCommentIndex]->getContent(), $matches);
4444

45-
/** @var array<string> $matches */
45+
/** @var list<string> $matches */
4646
$matches = $matches[1];
4747

4848
foreach ($matches as $dataProviderName) {

0 commit comments

Comments
 (0)