forked from shopware/shopware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php_cs.dist
75 lines (70 loc) · 2.84 KB
/
.php_cs.dist
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
<?php declare(strict_types=1);
$dir = __DIR__;
while (!file_exists($dir . '/composer.json') || !is_dir($dir . '/vendor')) {
if ($dir === \dirname($dir)) {
break;
}
$dir = \dirname($dir);
}
require $dir . '/vendor/autoload.php';
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixerCustomFixers\Fixer;
use PhpCsFixerCustomFixers\Fixers;
$finder = Finder::create()
->in(__DIR__ . '/src')
->name('*.php');
return Config::create()
->setRiskyAllowed(true)
->setUsingCache(false)
->registerCustomFixers(new Fixers())
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'phpdoc_order' => true,
'phpdoc_summary' => false,
// Removes @param and @return tags that don't provide any useful information.
'no_superfluous_phpdoc_tags' => true,
'blank_line_after_opening_tag' => false,
'concat_space' => ['spacing' => 'one'],
'array_syntax' => ['syntax' => 'short'],
'void_return' => true,
'class_attributes_separation' => ['elements' => ['method', 'property']],
// add declare strict type to every file
'declare_strict_types' => true,
// comparisons should always be strict
'strict_comparison' => true,
// use native phpunit methods
'php_unit_construct' => true,
// Enforce camel case for PHPUnit test methods
'php_unit_method_casing' => ['case' => 'camel_case'],
'php_unit_test_case_static_method_calls' => true,
'php_unit_dedicate_assert' => ['target' => 'newest'],
'php_unit_dedicate_assert_internal_type' => true,
'php_unit_mock' => true,
'php_unit_mock_short_will_return' => true,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
// functions should be used with $strict param set to true
'strict_param' => true,
'array_indentation' => true,
'compact_nullable_typehint' => true,
'modernize_types_casting' => true,
'mb_str_functions' => true,
Fixer\SingleSpaceAfterStatementFixer::name() => true,
Fixer\NoUselessCommentFixer::name() => true,
Fixer\NoImportFromGlobalNamespaceFixer::name() => true,
Fixer\OperatorLinebreakFixer::name() => true,
Fixer\PhpdocNoIncorrectVarAnnotationFixer::name() => true,
Fixer\NoUnneededConcatenationFixer::name() => true,
Fixer\NullableParamStyleFixer::name() => true,
'general_phpdoc_annotation_remove' => [
'annotations' => ['copyright', 'category'],
],
'single_line_throw' => false,
])
->setFinder($finder);