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: add missing key types in PHPDoc types #7779

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev-tools/phpstan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
'path' => __DIR__ . '/../../src/Doctrine/Annotation/Tokens.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$array \\(array\\<PhpCsFixer\\\\Doctrine\\\\Annotation\\\\Token\\>\\) of method PhpCsFixer\\\\Doctrine\\\\Annotation\\\\Tokens\\:\\:fromArray\\(\\) should be contravariant with parameter \\$array \\(array\\<int, mixed\\>\\) of method SplFixedArray\\<PhpCsFixer\\\\Doctrine\\\\Annotation\\\\Token\\>\\:\\:fromArray\\(\\)$#',
'message' => '#^Parameter \\#1 \\$array \\(array\\<int, PhpCsFixer\\\\Doctrine\\\\Annotation\\\\Token\\>\\) of method PhpCsFixer\\\\Doctrine\\\\Annotation\\\\Tokens\\:\\:fromArray\\(\\) should be contravariant with parameter \\$array \\(array\\<int, mixed\\>\\) of method SplFixedArray\\<PhpCsFixer\\\\Doctrine\\\\Annotation\\\\Token\\>\\:\\:fromArray\\(\\)$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Doctrine/Annotation/Tokens.php',
];
Expand Down
4 changes: 2 additions & 2 deletions src/Console/ConfigurationResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ private function iterableToTraversable(iterable $iterable): \Traversable
}

/**
* @return array<mixed>
* @return array<string, mixed>
*/
private function parseRules(): array
{
Expand Down Expand Up @@ -673,7 +673,7 @@ private function parseRules(): array
}

/**
* @param array<mixed> $rules
* @param array<string, mixed> $rules
*
* @throws InvalidConfigurationException
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/Annotation/Tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public static function createFromDocComment(PhpToken $input, array $ignoredTags
/**
* Create token collection from array.
*
* @param Token[] $array the array to import
* @param ?bool $saveIndices save the numeric indices used in the original array, default is yes
* @param array<int, Token> $array the array to import
* @param ?bool $saveIndices save the numeric indices used in the original array, default is yes
*/
public static function fromArray($array, $saveIndices = null): self
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
}

/**
* @param ArgumentAnalysis[] $arguments
* @param array<string, ArgumentAnalysis> $arguments
*/
private function fixFunctionParameters(Tokens $tokens, array $arguments): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/PhpUnit/PhpUnitNamespacedFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class PhpUnitNamespacedFixer extends AbstractFixer implements Configurable
* space class and need a dedicated translation table. This trans-
* lation table is defined in @see configure.
*
* @var array|string[] Class Mappings
* @var array<string, string> Class Mappings
*/
private $classMap;

Expand Down
2 changes: 1 addition & 1 deletion tests/Fixer/Alias/NoAliasFunctionsFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private static function provideAllCases(): iterable
{
$reflectionConstant = new \ReflectionClassConstant(NoAliasFunctionsFixer::class, 'SETS');

/** @var array<string, string[]> $allAliases */
/** @var array<string, array<string, string>> $allAliases */
$allAliases = $reflectionConstant->getValue();

$sets = $allAliases;
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixer/Alias/NoMixedEchoPrintFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public function testConfigure(): void
}

/**
* @param array<mixed> $wrongConfig
* @param array<string, mixed> $wrongConfig
*
* @dataProvider provideInvalidConfigurationCases
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixer/ClassNotation/ClassDefinitionFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testConfigure(): void
}

/**
* @param array<mixed> $config
* @param array<string, mixed> $config
*
* @dataProvider provideInvalidConfigurationCases
*/
Expand All @@ -59,7 +59,7 @@ public function testInvalidConfiguration(array $config, string $exceptionExpress
}

/**
* @return iterable<array{array<mixed>, string}>
* @return iterable<array{array<string, mixed>, string}>
*/
public static function provideInvalidConfigurationCases(): iterable
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixer/ClassNotation/FinalInternalClassFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class Foo {}
/**
* @group legacy
*
* @param array<mixed> $config
* @param array<string, mixed> $config
*
* @dataProvider provideInvalidConfigurationCases
*/
Expand All @@ -361,7 +361,7 @@ public function testInvalidConfiguration(array $config, string $exceptionExpress
}

/**
* @return iterable<array{array<mixed>, string, 2?: string}>
* @return iterable<array{array<string, mixed>, string, 2?: string}>
*/
public static function provideInvalidConfigurationCases(): iterable
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixer/ControlStructure/YodaStyleFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ public function testComplexConfiguration(): void
}

/**
* @param array<mixed> $config
* @param array<string, mixed> $config
*
* @dataProvider provideInvalidConfigCases
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ public function testFixPre80(string $expected, ?string $input = null, array $con
}

/**
* @return iterable<array{string, 1?: string, 2?: array<mixed>}>
* @return iterable<array{string, 1?: string, 2?: array<string, mixed>}>
*/
public static function provideFixPre80Cases(): iterable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static function provideFixCases(): iterable
}

/**
* @param array<mixed> $config
* @param array<string, mixed> $config
*
* @dataProvider provideInvalidConfigurationCases
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class Foo{ public function Bar(){ echo $reflection = new \ReflectionClass(get_cl
}

/**
* @param array<mixed> $config
* @param array<string, mixed> $config
*
* @dataProvider provideInvalidConfigurationKeysCases
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixer/Phpdoc/PhpdocReturnSelfReferenceFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public static function provideGeneratedFixCases(): iterable
}

/**
* @param array<mixed> $configuration
* @param array<string, mixed> $configuration
*
* @dataProvider provideInvalidConfigurationCases
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixer/Whitespace/NoSpacesAroundOffsetFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public function testFixWithConfiguration(string $expected, string $input, array
}

/**
* @return iterable<array{string, string, array<mixed>}>
* @return iterable<array{string, string, array{positions: array<string>}}>
*/
public static function provideFixWithConfigurationCases(): iterable
{
Expand Down Expand Up @@ -371,7 +371,7 @@ public function testFix80(string $expected, ?string $input, array $configuration
}

/**
* @return iterable<array{string, string, array<mixed>}>
* @return iterable<array{string, string, array{positions: array<string>}}>
*/
public static function provideFix80Cases(): iterable
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Test/AbstractIntegrationCaseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ private function determineCode(SplFileInfo $file, ?string $code, string $suffix)
}

/**
* @param null|array<mixed> $template
* @param null|array<string, mixed> $template
*
* @return array<mixed>
* @return array<string, mixed>
*/
private function parseJson(?string $encoded, array $template = null): array
{
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 @@ -400,7 +400,7 @@ public function testFunctionArgumentInfo(string $code, int $methodIndex, array $
}

/**
* @return iterable<array{string, int, array<ArgumentAnalysis>}>
* @return iterable<array{string, int, array<string, ArgumentAnalysis>}>
*/
public static function provideFunctionArgumentInfoCases(): iterable
{
Expand Down Expand Up @@ -593,7 +593,7 @@ public function testFunctionArgumentInfoPre80(string $code, int $methodIndex, ar
}

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