Skip to content

Commit 328a299

Browse files
committed
Add composer scripts for checking / fixing code style
1 parent 42c1043 commit 328a299

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ Please note that using `Constraint::CHECK_MODE_COERCE_TYPES` will modify your or
159159
## Running the tests
160160

161161
```bash
162-
composer test
163-
composer testOnly TestClass
164-
composer testOnly TestClass::testMethod
162+
composer test # run all unit tests
163+
composer testOnly TestClass # run specific unit test class
164+
composer testOnly TestClass::testMethod # run specific unit test method
165+
composer style-check # check code style for errors
166+
composer style-fix # automatically fix code style errors
165167
```

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"require-dev": {
4242
"json-schema/JSON-Schema-Test-Suite": "1.2.0",
4343
"phpunit/phpunit": "^4.8.22",
44-
"phpdocumentor/phpdocumentor": "~2"
44+
"phpdocumentor/phpdocumentor": "~2",
45+
"friendsofphp/php-cs-fixer": "^2.1"
4546
},
4647
"autoload": {
4748
"psr-4": { "JsonSchema\\": "src/JsonSchema/" }
@@ -58,6 +59,8 @@
5859
"scripts": {
5960
"test" : "vendor/bin/phpunit",
6061
"testOnly" : "vendor/bin/phpunit --colors --filter",
61-
"coverage" : "vendor/bin/phpunit --coverage-text"
62+
"coverage" : "vendor/bin/phpunit --coverage-text",
63+
"style-check" : "vendor/bin/php-cs-fixer fix --dry-run --verbose --diff",
64+
"style-fix" : "vendor/bin/php-cs-fixer fix --verbose"
6265
}
6366
}

0 commit comments

Comments
 (0)