Skip to content

Commit 8897f5b

Browse files
php-cs-fixer configuration
1 parent 3e91406 commit 8897f5b

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

.php_cs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
$finder = Symfony\CS\Finder\DefaultFinder::create()
3+
->in('src')
4+
->in('test')
5+
->notPath('temp');
6+
$config = Symfony\CS\Config\Config::create();
7+
$config->fixers(['ordered_use']);
8+
$config->finder($finder);
9+
return $config;

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ install:
2626
- composer update --prefer-source
2727

2828
script:
29+
- vendor/bin/php-cs-fixer fix -v --diff --dry-run
2930
- vendor/bin/behat --tags=~symfony27
3031
- >
3132
if [ "SYMFONY_VERSION" == "2.7.*" ]; then

CONTRIBUTING.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Running Coding Standards Checks
2+
3+
This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding
4+
standards checks, and provides configuration for our selected checks.
5+
`php-cs-fixer` is installed by default via Composer.
6+
7+
To run checks only:
8+
9+
```console
10+
$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs
11+
```
12+
13+
To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run`
14+
flag:
15+
16+
```console
17+
$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs
18+
```
19+
20+
If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure
21+
they pass, and make sure you add and commit the changes after verification.

composer.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@
2828
"symfony/console": "~2.5"
2929
},
3030
"require-dev": {
31-
"behat/behat": "~3.0",
3231
"beberlei/assert": "~2.1",
32+
"behat/behat": "~3.0",
33+
"fabpot/php-cs-fixer": "^1.10",
34+
"symfony/console": "~2.5",
35+
"symfony/finder": "~2.5",
36+
"symfony/form": "~2.5",
3337
"symfony/framework-bundle": "~2.5",
3438
"symfony/validator": "~2.5",
35-
"symfony/form": "~2.5",
36-
"symfony/yaml": "~2.5",
37-
"symfony/finder": "~2.5",
38-
"symfony/console": "~2.5"
39+
"symfony/yaml": "~2.5"
3940
}
4041
}

0 commit comments

Comments
 (0)