sudo: false

language: php

matrix:
  include:
    - php: 5.4
      env: COMPOSER_ARGUMENTS="--prefer-lowest --prefer-stable"
    - php: 5.4
    - php: 5.5
    - php: 5.6
    - php: 7.1
    - php: 7.2
      env: PHPUNIT_COVERAGE_ARGUMENT="--coverage-clover=coverage.clover"
    - php: 7.3
    - php: nightly
  allow_failures:
    - php: nightly
  fast_finish: true

before_script:
  - composer update --prefer-dist ${COMPOSER_ARGUMENTS}

script:
  - vendor/bin/phpunit --configuration phpunit.xml.dist --verbose --colors ${PHPUNIT_COVERAGE_ARGUMENT}

after_script:
  - |
    if [[ ! -z "${PHPUNIT_COVERAGE_ARGUMENT}" ]]; then
      wget https://scrutinizer-ci.com/ocular.phar
      php ocular.phar code-coverage:upload --format=php-clover coverage.clover
    fi
