-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php_cs
36 lines (28 loc) · 955 Bytes
/
.php_cs
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
<?php
$composerJsonPath = __DIR__ . '/composer.json';
$composerJson = file_get_contents($composerJsonPath);
$composerProject = json_decode($composerJson);
$currentYear = date('Y');
$projectHeader = <<<HEADER
Yii2 PHP CS Fixer Config
@author Kacper Pruszynski (plumthedev)
@link https://github.com/plumthedev/yii2-php-cs-fixer-config
@copyright Copyright (c) 2019 - {$currentYear} plumthedev
@license https://github.com/plumthedev/yii2-php-cs-fixer-config/blob/master/LICENSE
@version {$composerProject->version}
HEADER;
use plumthedev\PhpCsFixer\Config;
$csConfig = Config::create();
// CS Config setup
$csConfig->mergeRules([
'header_comment' => [
'header' => $projectHeader,
'commentType' => 'PHPDoc',
'separate' => 'bottom',
]
]);
// CS Finder setup
$csConfigFinder = $csConfig->getFinder();
$csConfigFinder->in(__DIR__); // set current project directory
$csConfig->setFinder($csConfigFinder);
return $csConfig;