diff --git a/src/Fixer/AttributeNotation/OrderedAttributesFixer.php b/src/Fixer/AttributeNotation/OrderedAttributesFixer.php index 8e9eb78c22b..3b54fbec0db 100644 --- a/src/Fixer/AttributeNotation/OrderedAttributesFixer.php +++ b/src/Fixer/AttributeNotation/OrderedAttributesFixer.php @@ -168,13 +168,11 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void while (null !== $index = $tokens->getNextTokenOfKind($index, [[T_ATTRIBUTE]])) { /** @var _AttributeItems $elements */ - $elements = array_map(function (AttributeAnalysis $attributeAnalysis) use ($tokens): array { - return [ - 'name' => $this->sortAttributes($tokens, $attributeAnalysis->getStartIndex(), $attributeAnalysis->getAttributes()), - 'start' => $attributeAnalysis->getStartIndex(), - 'end' => $attributeAnalysis->getEndIndex(), - ]; - }, AttributeAnalyzer::collect($tokens, $index)); + $elements = array_map(fn (AttributeAnalysis $attributeAnalysis): array => [ + 'name' => $this->sortAttributes($tokens, $attributeAnalysis->getStartIndex(), $attributeAnalysis->getAttributes()), + 'start' => $attributeAnalysis->getStartIndex(), + 'end' => $attributeAnalysis->getEndIndex(), + ], AttributeAnalyzer::collect($tokens, $index)); $endIndex = end($elements)['end']; diff --git a/src/Fixer/Internal/ConfigurableFixerTemplateFixer.php b/src/Fixer/Internal/ConfigurableFixerTemplateFixer.php index bed75e1c271..b38b7865f94 100644 --- a/src/Fixer/Internal/ConfigurableFixerTemplateFixer.php +++ b/src/Fixer/Internal/ConfigurableFixerTemplateFixer.php @@ -311,12 +311,10 @@ private function applyFixForSrc(\SplFileInfo $file, Tokens $tokens): void if ('array' === $allowed) { $default = $option->getDefault(); - $getTypes = static function ($values): array { - return array_unique(array_map( - static fn ($val) => \gettype($val), - $values - )); - }; + $getTypes = static fn ($values): array => array_unique(array_map( + static fn ($val) => \gettype($val), + $values + )); $defaultKeyTypes = $getTypes(array_keys($default)); $defaultValueTypes = $getTypes(array_values($default)); $allowed = \sprintf( diff --git a/tests/AutoReview/ProjectCodeTest.php b/tests/AutoReview/ProjectCodeTest.php index 44de22e448b..898e94332fc 100644 --- a/tests/AutoReview/ProjectCodeTest.php +++ b/tests/AutoReview/ProjectCodeTest.php @@ -509,15 +509,13 @@ public function testDataProvidersAreNonPhpVersionConditional(string $testClassNa $startIndex = $tokens->getNextTokenOfKind($methodIndex, ['{']); $endIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $startIndex); - $versionTokens = array_filter($tokens->findGivenKind(T_STRING, $startIndex, $endIndex), static function (Token $v): bool { - return $v->equalsAny([ - [T_STRING, 'PHP_VERSION_ID'], - [T_STRING, 'PHP_MAJOR_VERSION'], - [T_STRING, 'PHP_MINOR_VERSION'], - [T_STRING, 'PHP_RELEASE_VERSION'], - [T_STRING, 'phpversion'], - ], false); - }); + $versionTokens = array_filter($tokens->findGivenKind(T_STRING, $startIndex, $endIndex), static fn (Token $v): bool => $v->equalsAny([ + [T_STRING, 'PHP_VERSION_ID'], + [T_STRING, 'PHP_MAJOR_VERSION'], + [T_STRING, 'PHP_MINOR_VERSION'], + [T_STRING, 'PHP_RELEASE_VERSION'], + [T_STRING, 'phpversion'], + ], false)); self::assertCount( 0, diff --git a/tests/FixerFactoryTest.php b/tests/FixerFactoryTest.php index 933d1ebd45f..e923e9f2a58 100644 --- a/tests/FixerFactoryTest.php +++ b/tests/FixerFactoryTest.php @@ -334,15 +334,13 @@ public function testNoDoubleConflictReporting(): void - "c" with "d", "e" and "f" - "d" with "g" and "h" - "e" with "a"', - \Closure::bind(static function (FixerFactory $factory): string { - return $factory->generateConflictMessage([ - 'a' => ['b'], - 'b' => ['a'], - 'c' => ['d', 'e', 'f'], - 'd' => ['c', 'g', 'h'], - 'e' => ['a'], - ]); - }, null, FixerFactory::class)($factory), + \Closure::bind(static fn (FixerFactory $factory): string => $factory->generateConflictMessage([ + 'a' => ['b'], + 'b' => ['a'], + 'c' => ['d', 'e', 'f'], + 'd' => ['c', 'g', 'h'], + 'e' => ['a'], + ]), null, FixerFactory::class)($factory), ); }