-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathconfig.php
More file actions
42 lines (35 loc) · 1.37 KB
/
config.php
File metadata and controls
42 lines (35 loc) · 1.37 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
<?php
/**
* CS Fixer Config.
*
* @see https://github.com/FriendsOfPHP/PHP-CS-Fixer
*/
// Detect project root directory
$reflector = new \ReflectionClass('\Composer\Autoload\ClassLoader');
$project_root_dir = \dirname((string) $reflector->getFileName(), 3);
if (! empty($env_cache_file_path = \getenv('PHP_CS_FIX_CACHE_FILE_PATH')) && \is_string($env_cache_file_path)) {
$cache_file_path = $env_cache_file_path;
} else {
$cache_file_name = '.php_cs.cache';
$cache_file_path = \is_dir($project_root_dir . '/storage')
? $project_root_dir . '/storage/' . $cache_file_name
: $project_root_dir . '/' . $cache_file_name;
}
$rules = require __DIR__ . '/cs_rules.php';
$excludes = require __DIR__ . '/cs_excludes.php';
$config = new \PhpCsFixer\Config('Avto Develops Code Style Fixer');
$config
->setFinder(
\PhpCsFixer\Finder::create()
->exclude(\file_exists($user_excludes = $project_root_dir . '/.cs_excludes.php')
? \array_replace_recursive($excludes, require $user_excludes)
: $excludes)
->in($project_root_dir)
)
->setRiskyAllowed(true)
->setUsingCache(true)
->setRules(\file_exists($user_rules = $project_root_dir . '/.cs_rules.php')
? \array_replace_recursive($rules, require $user_rules)
: $rules)
->setCacheFile($cache_file_path);
return $config;