Skip to content

Commit 26945d0

Browse files
committed
Added kreta php-cs-fixer
1 parent e143304 commit 26945d0

File tree

5 files changed

+23
-81
lines changed

5 files changed

+23
-81
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
# For the full copyright and license information, please view the LICENSE
77
# file that was distributed with this source code.
88

9+
/.php_cs.cache
910
/composer.lock
1011
/vendor

composer.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,20 @@
3333
},
3434
"require-dev": {
3535
"doctrine/orm": "^2.5",
36-
"friendsofphp/php-cs-fixer": "^1.12",
36+
"kreta/php-cs-fixer-config": "^1.0",
3737
"phpspec/phpspec": "^3.2"
3838
},
3939
"scripts": {
4040
"cs": [
41-
"php-cs-fixer fix --config-file=etc/phpcs/.php_cs",
42-
"php-cs-fixer fix --config-file=etc/phpcs/.phpspec_cs"
41+
"php-cs-fixer fix --config=etc/phpcs/.php_cs -v",
42+
"php-cs-fixer fix --config=etc/phpcs/.phpspec_cs -v"
4343
]
4444
},
4545
"autoload": {
4646
"psr-4": {
4747
"Kreta\\SharedKernel\\": "src/Kreta/SharedKernel/",
4848
"Kreta\\SharedKernel\\Tests\\": "tests/"
4949
},
50-
"files": [
51-
"etc/phpcs/common.php"
52-
],
5350
"exclude-from-classmap": [
5451
"tests/"
5552
]

etc/phpcs/.php_cs

+9-14
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,15 @@
1010
* file that was distributed with this source code.
1111
*/
1212

13-
use Kreta\SharedKernel\CS;
13+
declare(strict_types=1);
1414

15-
CS\setHeader();
15+
use Kreta\PhpCsFixerConfig\KretaConfig;
1616

17-
$finder = Symfony\CS\Finder::create()
18-
->notName('*Spec.php')
19-
->name('*.php')
20-
->in([
21-
__DIR__ . '/../../src',
22-
__DIR__ . '/../../tests/Double',
23-
__DIR__ . '/../../tests/Matchers'
24-
]);
17+
$config = new KretaConfig();
18+
$config->getFinder()->in(__DIR__ . '/src');
2519

26-
return Symfony\CS\Config::create()
27-
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
28-
->finder($finder)
29-
->fixers(CS\fixers());
20+
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;
21+
22+
$config->setCacheFile($cacheDir . '/.php_cs.cache');
23+
24+
return $config;

etc/phpcs/.phpspec_cs

+10-10
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
* file that was distributed with this source code.
1111
*/
1212

13-
use Kreta\SharedKernel\CS;
13+
declare(strict_types=1);
1414

15-
CS\setHeader();
15+
use Kreta\PhpCsFixerConfig\KretaConfig;
1616

17-
$finder = Symfony\CS\Finder::create()
18-
->in([
19-
__DIR__ . '/../../tests/Spec',
20-
])
17+
$config = new KretaConfig(true);
18+
$config->getFinder()
19+
->in(__DIR__ . '/tests/Spec')
2120
->name('*Spec.php');
2221

23-
return Symfony\CS\Config::create()
24-
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
25-
->finder($finder)
26-
->fixers(array_merge(CS\fixers(), ['-visibility']));
22+
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;
23+
24+
$config->setCacheFile($cacheDir . '/.php_cs.cache');
25+
26+
return $config;

etc/phpcs/common.php

-51
This file was deleted.

0 commit comments

Comments
 (0)