group: travis_latest
language: php

matrix:
  include:
    - php: 7.1
      env: lowest=1
    - php: 7.2
      env: code_coverage=1
    - php: 7.3
    - php: nightly


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

install:
  - phpenv config-rm xdebug.ini || true;

  - |
    if [ "$lowest" = "1" ]; then
      composer update --prefer-lowest --prefer-stable;
    else
      composer update;
    fi;

script:
  - vendor/bin/php-cs-fixer fix --verbose --dry-run --diff --diff-format=udiff --allow-risky=yes
  - |
    if [ "$code_coverage" = "1" ]; then
      phpdbg -qrr vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover tests;
    else
      php vendor/bin/phpunit;
    fi;

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

group: travis_latest
language: php

matrix:
  include:
    - php: 7.1
      env: lowest=1
    - php: 7.2
      env:
        - code_coverage=1
        - csfixer=1
    - php: 7.3
    - php: nightly


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

install:
  - phpenv config-rm xdebug.ini || true;
  - |
    if [ "$csfixer" != "1" ]; then
      composer remove --dev friendsofphp/php-cs-fixer;
    fi;
  - |
    if [ "$lowest" = "1" ]; then
      composer update --prefer-lowest --prefer-stable;
    else
      composer update;
    fi;

script:
  - |
    if [ "$csfixer" = "1" ]; then
      vendor/bin/php-cs-fixer fix --verbose --dry-run --diff --diff-format=udiff --allow-risky=yes;
    fi;
  - |
    if [ "$code_coverage" = "1" ]; then
      phpdbg -qrr vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover tests;
    else
      php vendor/bin/phpunit;
    fi;

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

Work around PHP-CS-Fixer's refusal to install/run on newer PHP
Work around PHP-CS-Fixer's refusal to install/run on newer PHP
