Repository navigation
Expand file tree
/
Copy path.php-cs-fixer.php
More file actions
151 lines (147 loc) · 5.9 KB
/
Copy path.php-cs-fixer.php
File metadata and controls
151 lines (147 loc) · 5.9 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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
declare(strict_types=1);
use PhpCsFixer\Config;
use PhpCsFixer\Runner\Parallel\ParallelConfig;
$maxProcesses = function_exists('swoole_cpu_num') ? swoole_cpu_num() : 4;
return (new Config)
->setParallelConfig(new ParallelConfig($maxProcesses))
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'php_unit_internal_class' => false,
'php_unit_test_class_requires_covers' => false,
'phpdoc_no_alias_tag' => false,
'array_syntax' => [
'syntax' => 'short',
],
'list_syntax' => [
'syntax' => 'short',
],
'concat_space' => [
'spacing' => 'one',
],
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
// Imported native functions resolve at compile time like qualified calls, while call
// sites stay identical to upstream code. See bin/native-functions/README.md.
'import_functions' => true,
],
'blank_line_before_statement' => [
'statements' => [
'declare',
],
],
'general_phpdoc_annotation_remove' => [
'annotations' => [
'author',
],
],
'ordered_imports' => [
'imports_order' => [
'class', 'function', 'const',
],
'sort_algorithm' => 'alpha',
],
'single_line_comment_style' => [
'comment_types' => [],
],
'yoda_style' => [
'always_move_variable' => false,
'equal' => false,
'identical' => false,
],
'phpdoc_align' => [
'align' => 'left',
],
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'constant_case' => [
'case' => 'lower',
],
'class_attributes_separation' => true,
'combine_consecutive_unsets' => true,
'declare_strict_types' => true,
'linebreak_after_opening_tag' => true,
'lowercase_static_reference' => true,
'no_useless_else' => true,
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'not_operator_with_space' => false,
'ordered_class_elements' => [
'order' => [
'use_trait',
],
],
'phpdoc_to_comment' => [
'ignored_tags' => ['var'],
],
// This rewrite removes assignments captured by reference in nested closures.
'return_assignment' => false,
'php_unit_method_casing' => [
'case' => 'camel_case',
],
'php_unit_strict' => false,
'phpdoc_separation' => false,
'single_quote' => true,
'standardize_not_equals' => true,
'multiline_comment_opening_closing' => true,
'fully_qualified_strict_types' => false,
// Explicit nullable declarations avoid PHP 8.4 deprecations.
'nullable_type_declaration_for_default_null_value' => true,
'new_with_parentheses' => [
'named_class' => false,
'anonymous_class' => false,
],
'single_line_empty_body' => false,
'ordered_types' => [
'null_adjustment' => 'always_last',
'sort_algorithm' => 'none',
],
// Qualifies the listed native functions in namespaced files, which global_namespace_import
// then turns into `use function` imports. Calls without a namespace already resolve at
// compile time. The pinned list keeps the rewrite independent of local extensions; see
// bin/native-functions/README.md.
'native_function_invocation' => [
'include' => require __DIR__ . '/bin/native-functions/functions.php',
'exclude' => require __DIR__ . '/bin/native-functions/excluded.php',
'scope' => 'namespaced',
'strict' => false,
],
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('_archive')
->exclude('_tmp')
->exclude('node_modules')
->exclude('overrides')
// Skeletons are checked with their own formatter configuration in CI.
->exclude('skeletons')
->exclude('dogfood/ai/workbench/storage')
->exclude('src/testbench/workbench/bootstrap/cache')
->exclude('src/testbench/workbench/runtime')
->exclude('src/testbench/workbench/storage')
->exclude('vendor')
->notPath('#^bin/(?!sync-skeleton-config/|native-functions/)#')
// These deliberately omit strict_types so PHP applies its native weak scalar conversion.
->notPath('src/container/src/NativeInvoker.php')
->notPath('src/data/src/Support/Creation/NativeScalar.php')
// The SDK fixture is compared byte-for-byte with fresh generator output.
->exclude('types/SdkGenerator/AnalysedSdk/generated')
->notPath('tests/Data/Fixtures/PhpDocTypeContext.php')
->notPath('tests/Foundation/Fixtures/fake-compiled-view.php')
// The unqualified strlen() call must resolve to the fixture's namespaced strlen().
->notPath('tests/PHPStan/Fixtures/Macros/namespaced-macros.php')
// These fixtures declare namespaced native functions for the native function scanner's tests.
->notPath('tests/Foundation/Console/Fixtures/NativeFunctions/')
// Analyzer data and the fixture application mirror upstream Larastan fixtures, whose syntax and line numbers are deliberate.
->notPath('#^tests/PHPStan/((.+/)?data|application)/#')
->name('hypervel-sdk')
->name('hypervel-test-profile')
->in(__DIR__)
)
->setUsingCache(false);