diff --git a/.gitignore b/.gitignore index 4e3728b..6586246 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -.idea/ composer.phar composer.lock +phpcs.xml vendor/ -bin/ diff --git a/.travis.yml b/.travis.yml index 648e187..45e4636 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,6 @@ dist: trusty language: php php: - - 5.6 - - 7.0 - 7.1 - 7.2 - nightly @@ -47,3 +45,21 @@ jobs: after_script: - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover clover.xml + - stage: Pull request coding standard + if: type = pull_request + install: travis_retry composer install --prefer-dist + script: + - | + if [ $TRAVIS_BRANCH != "master" ]; then + git remote set-branches --add origin $TRAVIS_BRANCH; + git fetch origin $TRAVIS_BRANCH; + fi + - git merge-base origin/$TRAVIS_BRANCH $TRAVIS_PULL_REQUEST_SHA || git fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge --unshallow + - wget https://github.com/diff-sniffer/git/releases/download/0.1.0/git-phpcs.phar + - php git-phpcs.phar origin/$TRAVIS_BRANCH...$TRAVIS_PULL_REQUEST_SHA + - stage: Coding standard + if: NOT type = pull_request + php: 7.1 + install: travis_retry composer install --prefer-dist + script: + - ./vendor/bin/phpcs diff --git a/composer.json b/composer.json index 27bfc82..d4de73a 100644 --- a/composer.json +++ b/composer.json @@ -9,10 +9,11 @@ "API" ], "require": { - "php": ">=5.6", + "php": "^7.1", "ext-mbstring": "*" }, "require-dev": { + "doctrine/coding-standard": "^4.0", "phpunit/phpunit": "^4.8", "psr/http-message": "^1.0" }, diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..4be54dd --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,93 @@ + + + + + + + + + + + + src + tests + + + + + + + + + + + + + + + + + + + + +