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

php:
    - 7.1
    - 7.2
    - 7.3
    - 7.4

env:
    global:
        - SYMFONY_DEPRECATIONS_HELPER="max[self]=0&max[direct]=0"

jobs:
    include:
          # Minimum supported PHP and Symfony version
        - stage: test
          php: 7.1
          env: DEPENDENCIES="minimum"

          # Test LTS version we support
        - stage: test
          php: 7.3
          env: DEPENDENCIES="symfony/lts:v3"

        - stage: test
          php: 7.3
          env: DEPENDENCIES="dev"

        - stage: test
          php: nightly
          before_install:
              - composer config platform.php 7.4.99
              - composer config minimum-stability dev

        # Run phpcs
        - stage: Code Quality
          php: 7.2
          env: CODING_STANDARDS
          script:
              - vendor/bin/phpcs

before_install:
    - if [ "$DEPENDENCIES" = "minimum" ]; then COMPOSER_FLAGS="--prefer-stable --prefer-lowest"; fi;
    - if [ "$DEPENDENCIES" = "dev" ]; then composer config minimum-stability dev; fi;
    - if [[ $DEPENDENCIES == *"/"* ]]; then composer require --no-update $DEPENDENCIES; fi;

install:
    - travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction

script:
    - vendor/bin/phpunit
