language: php

sudo: false

cache:
    directories:
        - $HOME/.composer/cache/files

php:
    - 7.1
    - 7.2
    - 7.3
matrix:
    include:
        - php: 7.3
          env: DEPENDENCIES=dev LINT=1
        - php: 7.1
          env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable'

before_install:
    - phpenv config-rm xdebug.ini || true
    - composer self-update
    - if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;

install: composer update --prefer-dist $COMPOSER_FLAGS

# Fail CI if repo is in dirty state after bin/update_readme
before_script: ./bin/update_readme && git diff --exit-code README.md

script:
    - ./vendor/bin/simple-phpunit
    - if [ "$LINT" = 1 ]; then ./vendor/bin/phpstan analyse; fi;
