Skip to content

Commit 421dda4

Browse files
authored
Update minimum PHP version to 7.4 (#744)
1 parent a3d990e commit 421dda4

File tree

10 files changed

+15
-34
lines changed

10 files changed

+15
-34
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ public function getFixerToRunBeforeNames(): array
8181
private function getFixerNames(array $priorityFixers): array
8282
{
8383
$fixers = \array_map(
84-
static function (self $priorityFixer): string {
85-
return (new \ReflectionObject($priorityFixer->fixer))->getShortName();
86-
},
84+
static fn (self $priorityFixer): string => (new \ReflectionObject($priorityFixer->fixer))->getShortName(),
8785
$priorityFixers
8886
);
8987

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,7 @@ private function fixers(): string
198198

199199
foreach ($fixer->getConfigurationDefinition()->getOptions() as $option) {
200200
if ($option->getAllowedValues() !== null) {
201-
$allowed = \array_map(static function (string $value): string {
202-
return \sprintf('\'%s\'', $value);
203-
}, $option->getAllowedValues());
201+
$allowed = \array_map(static fn (string $value): string => \sprintf('\'%s\'', $value), $option->getAllowedValues());
204202
} else {
205203
/** @var array<string> $allowed */
206204
$allowed = $option->getAllowedTypes();

.github/workflows/ci.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,14 @@ jobs:
2727
matrix:
2828
os: [ macos-latest, ubuntu-latest, windows-latest ]
2929
php-version: [ '7.4', '8.1' ]
30+
composer-flags: [ '' ]
3031
coverage-driver: [ none ]
3132
install-fixer-from-master-branch: [ false ]
3233
include:
3334
- os: ubuntu-latest
34-
php-version: '7.2'
35-
composer_flags: '--prefer-lowest'
35+
php-version: '7.4'
36+
composer-flags: '--prefer-lowest'
3637
description: 'with lowest dependencies'
37-
- os: ubuntu-latest
38-
php-version: '7.2'
39-
- os: ubuntu-latest
40-
php-version: '7.3'
4138
- os: ubuntu-latest
4239
php-version: '8.0'
4340
- os: ubuntu-latest
@@ -50,7 +47,7 @@ jobs:
5047
description: 'with PHP CS Fixer from master'
5148
- os: ubuntu-latest
5249
php-version: '8.2'
53-
composer_flags: '--ignore-platform-reqs'
50+
composer-flags: '--ignore-platform-reqs'
5451
runs-on: ${{ matrix.os }}
5552
timeout-minutes: 10
5653
env:
@@ -70,7 +67,7 @@ jobs:
7067
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
7168
- if: matrix.install-fixer-from-master-branch
7269
run: composer require friendsofphp/php-cs-fixer:dev-master --no-update
73-
- run: composer update --no-progress ${{ matrix.composer_flags }}
70+
- run: composer update --no-progress ${{ matrix.composer-flags }}
7471
- run: composer test -- --coverage-clover=./build/logs/clover.xml
7572
- if: matrix.coverage-driver == 'pcov'
7673
env:

.php-cs-fixer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
unset($rules['assign_null_coalescing_to_coalesce_equal']); // TODO: remove when dropping support to PHP <8.0
3333
unset($rules['get_class_to_class_keyword']); // TODO: remove when dropping support to PHP <8.0
3434
unset($rules['modernize_strpos']); // TODO: remove when dropping support to PHP <8.0
35-
unset($rules['use_arrow_functions']); // TODO: remove when dropping support to PHP <7.4
3635
unset($rules[PhpCsFixerCustomFixers\Fixer\PhpdocOnlyAllowedAnnotationsFixer::name()]); // TODO: remove after new php-cs-fixer-config release
3736
unset($rules[PhpCsFixerCustomFixers\Fixer\PromotedConstructorPropertyFixer::name()]); // TODO: remove when dropping support to PHP <8.0
3837
$rules['trailing_comma_in_multiline'] = true; // TODO: remove when dropping support to PHP <8.0

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# CHANGELOG for PHP CS Fixer: custom fixers
22

33
## v3.8.0
4+
- Update minimum PHP version to 7.4
45
- DataProviderStaticFixer - add option "force"
56

67
## v3.7.0

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^7.2 || ^8.0",
13+
"php": "^7.4 || ^8.0",
1414
"ext-filter": "*",
1515
"ext-tokenizer": "*",
1616
"friendsofphp/php-cs-fixer": "^3.1.0",

src/Fixer/PhpUnitNoUselessReturnFixer.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ public function getDefinition(): FixerDefinitionInterface
3030
\sprintf(
3131
'PHPUnit %s functions should not be followed directly by return.',
3232
Utils::naturalLanguageJoinWithBackticks(\array_map(
33-
static function (array $token): string {
34-
return $token[1];
35-
},
33+
static fn (array $token): string => $token[1],
3634
self::FUNCTION_TOKENS
3735
))
3836
),

tests/AutoReview/SrcCodeTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,10 @@ public function testThereIsNoPregFunctionUsedDirectly(string $className): void
114114

115115
$stringTokens = \array_filter(
116116
$tokens,
117-
static function (Token $token): bool {
118-
return $token->isGivenKind(\T_STRING);
119-
}
117+
static fn (Token $token): bool => $token->isGivenKind(\T_STRING)
120118
);
121119
$strings = \array_map(
122-
static function (Token $token): string {
123-
return $token->getContent();
124-
},
120+
static fn (Token $token): string => $token->getContent(),
125121
$stringTokens
126122
);
127123
$strings = \array_unique($strings);

tests/AutoReview/TestsCodeTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ private function getDataProviders(string $className): array
157157
{
158158
return \array_filter(
159159
$this->getMethods($className, \ReflectionMethod::IS_PUBLIC),
160-
static function (\ReflectionMethod $reflectionMethod): bool {
161-
return \strpos($reflectionMethod->getName(), 'provide') === 0;
162-
}
160+
static fn (\ReflectionMethod $reflectionMethod): bool => \strpos($reflectionMethod->getName(), 'provide') === 0
163161
);
164162
}
165163

@@ -172,9 +170,7 @@ private function getMethods(string $className, ?int $methodFilter = null): array
172170

173171
return \array_filter(
174172
$reflectionClass->getMethods($methodFilter),
175-
static function (\ReflectionMethod $reflectionMethod) use ($reflectionClass): bool {
176-
return $reflectionMethod->getFileName() === $reflectionClass->getFileName();
177-
}
173+
static fn (\ReflectionMethod $reflectionMethod): bool => $reflectionMethod->getFileName() === $reflectionClass->getFileName()
178174
);
179175
}
180176

tests/FixersTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ public static function provideFixerIsInCollectionCases(): iterable
6868
private function fixerNamesFromCollection(): array
6969
{
7070
return \array_map(
71-
static function (FixerInterface $fixer): string {
72-
return $fixer->getName();
73-
},
71+
static fn (FixerInterface $fixer): string => $fixer->getName(),
7472
\iterator_to_array(new Fixers())
7573
);
7674
}

0 commit comments

Comments
 (0)