-
Notifications
You must be signed in to change notification settings - Fork 29
/
.php-cs-fixer.dist.php
90 lines (80 loc) · 2.84 KB
/
.php-cs-fixer.dist.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
namespace Revolt;
use PhpCsFixer\Config as PhpCsFixerConfig;
final class Config extends PhpCsFixerConfig
{
private string $src;
public function __construct()
{
parent::__construct('Revolt');
$this->setRiskyAllowed(true);
$this->setLineEnding("\n");
$this->src = __DIR__ . '/src';
}
public function getRules(): array
{
return [
"@PSR1" => true,
"@PSR2" => true,
"@PSR12" => true,
"braces" => [
"allow_single_line_closure" => true,
],
"array_syntax" => ["syntax" => "short"],
"blank_lines_before_namespace" => true,
"cast_spaces" => true,
"combine_consecutive_unsets" => true,
"declare_strict_types" => true,
"function_to_constant" => true,
"native_function_invocation" => [
'include' => [
'@internal',
'pcntl_async_signals',
'pcntl_signal_dispatch',
'pcntl_signal',
'posix_kill',
'uv_loop_new',
'uv_poll_start',
'uv_poll_stop',
'uv_now',
'uv_run',
'uv_poll_init_socket',
'uv_timer_init',
'uv_timer_start',
'uv_timer_stop',
'uv_signal_init',
'uv_signal_start',
'uv_signal_stop',
'uv_update_time',
'uv_is_active',
],
],
"multiline_whitespace_before_semicolons" => true,
"no_unused_imports" => true,
"no_useless_else" => true,
"no_useless_return" => true,
"no_whitespace_before_comma_in_array" => true,
"no_whitespace_in_blank_line" => true,
"non_printable_character" => true,
"normalize_index_brace" => true,
"ordered_imports" => ['imports_order' => ['class', 'const', 'function']],
"php_unit_construct" => true,
"php_unit_dedicate_assert" => true,
"php_unit_fqcn_annotation" => true,
"phpdoc_scalar" => ["types" => ['boolean', 'double', 'integer', 'real', 'str']],
"phpdoc_summary" => true,
"phpdoc_types" => ["groups" => ["simple", "meta"]],
"psr_autoloading" => ['dir' => $this->src],
"return_type_declaration" => ["space_before" => "none"],
"short_scalar_cast" => true,
"line_ending" => true,
];
}
}
$config = new Config;
$config->getFinder()
->in(__DIR__ . '/examples')
->in(__DIR__ . '/src')
->in(__DIR__ . '/test');
$config->setCacheFile(__DIR__ . '/.php-cs-fixer.cache');
return $config;