forked from PHP-CS-Fixer/PHP-CS-Fixer
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.php-cs-fixer.php-highest.php
More file actions
60 lines (49 loc) · 2.01 KB
/
.php-cs-fixer.php-highest.php
File metadata and controls
60 lines (49 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <[email protected]>
* Dariusz Rumiński <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
use PhpCsFixer\Config;
use PhpCsFixer\Future;
// @phpstan-ignore greaterOrEqual.alwaysFalse, booleanOr.alwaysFalse (PHPStan thinks that 80499 is max PHP version ID)
if (\PHP_VERSION_ID < 8_05_00 || \PHP_VERSION_ID >= 8_06_00) {
fwrite(\STDERR, "PHP CS Fixer's config for PHP-HIGHEST can be executed only on highest supported PHP version - 8.5.*.\n");
fwrite(\STDERR, "Running it on lower PHP version would prevent calling migration rules.\n");
exit(1);
}
$config = require __DIR__.'/.php-cs-fixer.dist.php';
Closure::bind(
static function (Config $config): void { $config->name = 'PHP-HIGHEST'.(Future::isFutureModeEnabled() ? ' (future mode)' : ''); },
null,
Config::class,
)($config);
$config->getFinder()->notPath([
'src/Tokenizer/Tokens.php', // due to some quirks on SplFixedArray typing
]);
$typesMap = [
'T' => 'mixed',
'TFixerInputConfig' => 'array',
'TFixerComputedConfig' => 'array',
'TFixer' => '\PhpCsFixer\AbstractFixer',
'_PhpTokenKind' => 'int|string',
'_PhpTokenArray' => 'array{0: int, 1: string}',
'_PhpTokenArrayPartial' => 'array{0: int, 1?: string}',
'_PhpTokenPrototype' => '_PhpTokenArray|string',
'_PhpTokenPrototypePartial' => '_PhpTokenArrayPartial|string',
];
$config->setRules(array_merge($config->getRules(), [
'@PHP8x5Migration' => true,
'@PHP8x5Migration:risky' => true,
'phpdoc_to_param_type' => ['types_map' => $typesMap],
'phpdoc_to_return_type' => ['types_map' => $typesMap],
'phpdoc_to_property_type' => ['types_map' => $typesMap],
'fully_qualified_strict_types' => ['import_symbols' => true],
'php_unit_attributes' => false, // as is not yet supported by PhpCsFixerInternal/configurable_fixer_template
]));
return $config;