forked from shopware/shopware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php_cs.dist
66 lines (61 loc) · 2.4 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
<?php declare(strict_types=1);
$dir = $vendorDir = __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')
->exclude([
'Docs/Resources/characteristics-module-descriptions.php' // auto generated
]);
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,
'phpdoc_order' => true,
'phpdoc_summary' => false,
'blank_line_after_opening_tag' => false,
'concat_space' => ['spacing' => 'one'],
'array_syntax' => ['syntax' => 'short'],
// Removes @param and @return tags that don't provide any useful information.
'no_superfluous_phpdoc_tags' => true,
// add declare strict type to every file
'declare_strict_types' => true,
// use native phpunit methods
'php_unit_construct' => true,
// Enforce camel case for PHPUnit test methods
'php_unit_method_casing' => ['case' => 'camel_case'],
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
'php_unit_test_case_static_method_calls' => true,
// comparisons should always be strict
'strict_comparison' => true,
// functions should be used with $strict param set to true
'strict_param' => true,
'array_indentation' => true,
'compact_nullable_typehint' => true,
Fixer\SingleSpaceAfterStatementFixer::name() => true,
Fixer\NoUselessCommentFixer::name() => true,
Fixer\PhpdocNoSuperfluousParamFixer::name() => true,
Fixer\NoImportFromGlobalNamespaceFixer::name() => true,
Fixer\OperatorLinebreakFixer::name() => true,
Fixer\PhpdocNoIncorrectVarAnnotationFixer::name() => true,
Fixer\NoUnneededConcatenationFixer::name() => true,
Fixer\NullableParamStyleFixer::name() => true,
])
->setFinder($finder);