Skip to content

Commit 4e9dea8

Browse files
committed
Add Coding Standard
1 parent bc98194 commit 4e9dea8

File tree

4 files changed

+48
-2
lines changed

4 files changed

+48
-2
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.phpcs-cache
2+
phpcs.xml
13
phpunit.xml
24
composer.lock
35
vendor/

.travis.yml

+21
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,27 @@ jobs:
5454
- composer config minimum-stability dev
5555
- travis_retry composer update -n --prefer-dist
5656

57+
- stage: Pull request coding standard
58+
if: type = pull_request
59+
php: 7.1
60+
install: travis_retry composer install --prefer-dist
61+
script:
62+
- |
63+
if [ $TRAVIS_BRANCH != "master" ]; then
64+
git remote set-branches --add origin $TRAVIS_BRANCH;
65+
git fetch origin $TRAVIS_BRANCH;
66+
fi
67+
- git merge-base origin/$TRAVIS_BRANCH $TRAVIS_PULL_REQUEST_SHA || git fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge --unshallow
68+
- wget https://github.com/diff-sniffer/git/releases/download/0.1.0/git-phpcs.phar
69+
- php git-phpcs.phar origin/$TRAVIS_BRANCH...$TRAVIS_PULL_REQUEST_SHA
70+
71+
# - stage: Coding standard
72+
# if: NOT type = pull_request
73+
# php: 7.1
74+
# install: travis_retry composer install --prefer-dist
75+
# script:
76+
# - ./vendor/bin/phpcs
77+
5778
- stage: Code Quality
5879
install: travis_retry composer install --prefer-dist
5980
script: vendor/bin/phpstan analyse -c phpstan.neon src

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
"ext-curl": "*"
1818
},
1919
"require-dev": {
20-
"phpunit/phpunit": "^7.0",
21-
"phpstan/phpstan": "^0.9.2"
20+
"doctrine/coding-standard": "^4.0",
21+
"phpstan/phpstan": "^0.9.2",
22+
"phpunit/phpunit": "^7.0"
2223
},
2324
"autoload": {
2425
"psr-4": {

phpcs.xml.dist

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ruleset>
3+
<arg name="basepath" value="."/>
4+
<arg name="extensions" value="php"/>
5+
<arg name="colors"/>
6+
<arg name="parallel" value="80"/>
7+
<arg name="cache" value=".phpcs-cache"/>
8+
9+
<!-- Ignore warnings, show progress of the run and show sniff names -->
10+
<arg value="nps"/>
11+
12+
<file>src</file>
13+
14+
<rule ref="Doctrine"/>
15+
16+
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
17+
<properties>
18+
<property name="psr12Compatible" type="bool" value="true"/>
19+
</properties>
20+
</rule>
21+
22+
</ruleset>

0 commit comments

Comments
 (0)