Skip to content

Commit 392b5d0

Browse files
committed
add phpcs
1 parent 11bd498 commit 392b5d0

File tree

4 files changed

+2086
-1
lines changed

4 files changed

+2086
-1
lines changed

.php_cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ return PhpCsFixer\Config::create()
1616
'native_constant_invocation' => true,
1717
'combine_nested_dirname' => true,
1818
'list_syntax' => ['syntax' => 'short'],
19+
'phpdoc_to_comment' => false,
1920
])
2021
->setRiskyAllowed(true)
2122
->setFinder(
2223
PhpCsFixer\Finder::create()
2324
->in(__DIR__.'/src')
25+
->in(__DIR__.'/tests')
2426
)
2527
;

docs/contribute.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ docker run -e "FILTER_REGEX_INCLUDE=/tmp/lint/src/.*" -e RUN_LOCAL=true -v ${PWD
4747

4848
Full details here: https://github.com/github/super-linter/blob/master/docs/run-linter-locally.md
4949

50+
To autolint with phpcs-fixer:
51+
52+
```bash
53+
composer install --working-dir=tools/php-cs-fixer
54+
PHP_CS_FIXER_IGNORE_ENV=1 tools/php-cs-fixer/vendor/bin/php-cs-fixer fix
55+
```
56+
5057
## How to generate PHP Doc
5158

5259
```bash
@@ -62,9 +69,14 @@ We use the git workflow [Github Flow](https://guides.github.com/introduction/flo
6269
```bash
6370
git checkout -b <basic-name> # the name is not important now, you can type "new-features"
6471
git commit # as mush as necessary.
65-
docker-compose run --rm app vendor/bin/phpdoc-md # regenerate php doc
72+
73+
PHP_CS_FIXER_IGNORE_ENV=1 tools/php-cs-fixer/vendor/bin/php-cs-fixer fix # fix coding standards
74+
./tests-local.sh # check tests are still OK
75+
docker-compose run --rm app vendor/bin/phpdoc-md # Regenerate php doc
76+
6677
git branch -m <name-of-the-branch> # to rename the branch to what has really be done.
6778
git push origin :<basic-name> && git push origin <name-of-the-branch> # Only if already pushed
79+
6880
gh pr create --fill
6981
```
7082

tools/php-cs-fixer/composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": {
3+
"friendsofphp/php-cs-fixer": "^2.17"
4+
}
5+
}

0 commit comments

Comments
 (0)