forked from RetroAchievements/RAWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.php-cs-fixer.php
68 lines (61 loc) · 2.25 KB
/
.php-cs-fixer.php
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
61
62
63
64
65
66
67
68
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
// TODO use Laravel Pint as convenient wrapper for PHP CS Fixer
$rules = [
/*
* RuleSet cascades/overrides:
* @PhpCsFixer (risky) https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/src/RuleSet/Sets/PhpCsFixerSet.php
* @Symfony https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/src/RuleSet/Sets/SymfonySet.php
* @PSR12 https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/src/RuleSet/Sets/PSR12Set.php
* @PSR2 https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/src/RuleSet/Sets/PSR2Set.php
*/
'@Symfony' => true,
// @Symfony overrides
'braces' => false, // TODO remove as soon as inline php tags with echos are gone?
'concat_space' => ['spacing' => 'one'],
'echo_tag_syntax' => false,
'global_namespace_import' => true,
'increment_style' => ['style' => 'post'],
'no_alternative_syntax' => false,
'no_extra_blank_lines' => [
'tokens' => [
'extra',
'throw',
'use',
],
],
'not_operator_with_space' => false,
'phpdoc_align' => false,
'phpdoc_separation' => false,
'phpdoc_summary' => false,
'phpdoc_to_comment' => false,
'single_line_throw' => false,
'single_line_comment_style' => [
'comment_types' => ['hash'],
],
'semicolon_after_instruction' => false,
'single_quote' => false,
'yoda_style' => false,
// 'declare_strict_types' => true, // TODO add as soon as php files in public have been fully ported
];
$project_path = getcwd();
$finder = Finder::create()
->in([
$project_path . '/app',
$project_path . '/app_legacy',
$project_path . '/config',
$project_path . '/database',
$project_path . '/lang',
$project_path . '/public', // no strict types here
$project_path . '/resources', // no strict types here
$project_path . '/tests',
])
// ->filter(fn (SplFileInfo $filename) => !in_array($filename->getRealPath(), [
// $project_path . '/app_legacy/Helpers/util/recaptcha.php',
// ]))
->name('*.php');
return (new Config())
->setFinder($finder)
->setRules($rules)
->setRiskyAllowed(true);