language: php

php:
  - 7.1
  - 7.2
  - 7.3
  - 7.4

sudo: false

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

matrix:
  fast_finish: true
  include:
    - php: 7.1
      env: COMPOSER_FLAGS="--prefer-lowest"
    - php: 7.2
      env: SYMFONY_VERSION=^3.4
    - php: 7.3
      env: SYMFONY_VERSION=^4.0
    - php: 7.3
      env: SYMFONY_VERSION=^5.0
    - php: 7.4
      env: SYMFONY_VERSION=^4.0
    - php: 7.4
      env: SYMFONY_VERSION=^5.0

before_install:
    - phpenv config-rm xdebug.ini || true
    - if [ "$SYMFONY_VERSION" == "^5.0" ]; then composer remove friendsofsymfony/rest-bundle --dev; fi;
    - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --dev --no-update; fi;

install: composer update --no-interaction $COMPOSER_FLAGS

script: ./phpunit
