Skip to content

Commit 94c98c6

Browse files
committed
Require PHP CS fixer and add basic configuration
1 parent 859f4c5 commit 94c98c6

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/phpspec.yml
55
/phpunit.xml
66
/vendor/
7+
/.php_cs.cache

.php_cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
<?php
22

3-
/*
4-
* In order to make it work, fabpot/php-cs-fixer and sllh/php-cs-fixer-styleci-bridge must be installed globally
5-
* with composer.
6-
*
7-
* @link https://github.com/Soullivaneuh/php-cs-fixer-styleci-bridge
8-
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer
9-
*/
3+
$config = PhpCsFixer\Config::create();
4+
$config->setRules([
5+
'@PSR2' => true,
6+
'@Symfony' => true,
7+
'array_syntax' => [
8+
'syntax' => 'short',
9+
],
10+
]);
1011

11-
use SLLH\StyleCIBridge\ConfigBridge;
12+
$finder = PhpCsFixer\Finder::create();
13+
$finder->in([
14+
'src',
15+
'spec'
16+
]);
1217

13-
return ConfigBridge::create();
18+
$config->setFinder($finder);
19+
20+
return $config;

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"guzzlehttp/psr7": "^1.4",
2323
"phpspec/phpspec": "^3.4 || ^4.2",
2424
"phpspec/prophecy": ">=1.8",
25-
"sebastian/comparator": ">=2"
25+
"sebastian/comparator": ">=2",
26+
"friendsofphp/php-cs-fixer": "^2.2"
2627
},
2728
"suggest": {
2829
"php-http/logger-plugin": "PSR-3 Logger plugin",
@@ -35,6 +36,8 @@
3536
}
3637
},
3738
"scripts": {
39+
"cs-check": "vendor/bin/php-cs-fixer fix --dry-run",
40+
"cs-fix": "vendor/bin/php-cs-fixer fix",
3841
"test": "vendor/bin/phpspec run",
3942
"test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml"
4043
},

0 commit comments

Comments
 (0)