diff --git a/.travis.yml b/.travis.yml index 7402096..390153d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,20 @@ language: php -sudo: false - matrix: include: - php: 7.2 - php: 7.1 env: deps='dev' - php: 7.1 - env: deps='low' -# XXX This needs proper fixing -# - php: 7.1 -# env: lint=1 + env: lint=1 + sudo: required + services: + - docker + addons: + apt: + packages: + - docker-ce + fast_finish: true cache: @@ -21,9 +24,6 @@ cache: before_install: - phpenv config-rm xdebug.ini || echo "xdebug not available" - echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - if [[ $lint = 1 ]]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.3.2/php-cs-fixer.phar; fi - - if [[ $lint = 1 ]]; then composer global require --dev 'phpstan/phpstan:^0.8'; fi - - export PATH="$PATH:$HOME/.composer/vendor/bin" install: - if [[ ! $deps ]]; then composer update --prefer-dist --no-progress --no-suggest --ansi; fi @@ -38,5 +38,4 @@ script: export SYMFONY_DEPRECATIONS_HELPER=strict fi - if [[ ! $lint ]]; then vendor/bin/phpunit --verbose; fi - - if [[ $lint = 1 ]]; then php php-cs-fixer.phar fix --dry-run --diff --no-ansi; fi - - if [[ $lint = 1 ]]; then phpstan analyse -c phpstan.neon -l5 --ansi src tests; fi + - if [[ $lint = 1 ]]; then make ci; fi diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5de5375 --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +QA_DOCKER_IMAGE=jakzal/phpqa:1.23-alpine +QA_DOCKER_COMMAND=docker run -it --rm -v "$(shell pwd):/project" -w /project ${QA_DOCKER_IMAGE} + +ci: cs-full-check phpstan +lint: cs-full-check phpstan + +phpstan: + sh -c "${QA_DOCKER_COMMAND} phpstan analyse --configuration phpstan.neon --level 6 ." + +cs: + sh -c "${QA_DOCKER_COMMAND} php-cs-fixer fix -vvv --diff" + +cs-full: + sh -c "${QA_DOCKER_COMMAND} php-cs-fixer fix -vvv --using-cache=false --diff" + +cs-full-check: + sh -c "${QA_DOCKER_COMMAND} php-cs-fixer fix -vvv --using-cache=false --diff --dry-run" + +in-docker-install-dev: + rm -f composer.lock + cp composer.json _composer.json + composer.phar config minimum-stability dev + composer.phar update --no-progress --no-interaction --no-suggest --optimize-autoloader --ansi + mv _composer.json composer.json + +.PHONY: phpstan cs cs-full cs-full-checks diff --git a/phpstan.neon b/phpstan.neon index 5687135..3d3fe87 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,10 +1,13 @@ parameters: autoload_files: - vendor/autoload.php + excludes_analyse: + - vendor/ + - %currentWorkingDirectory%/tests/** ignoreErrors: # Tests - - '#Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy::[a-zA-Z0-9_]+\(\)#' + #- '#Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy::[a-zA-Z0-9_]+\(\)#' #- '#Access to an undefined property Prophecy\\Prophecy\\ObjectProphecy::\$[a-zA-Z0-9_]+#' #- '#Call to an undefined method PHPUnit_Framework_MockObject_MockObject::[a-zA-Z0-9_]+\(\)#' #- '#expects\s+[^\s]+, PHPUnit_Framework_MockObject_MockObject(\[\])? given#'