language: php
dist: bionic

php:
  - 7.2
  - 7.3
  - 7.4
  - nightly

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

before_script:
  # Deactivate xdebug
  - if [[ $TRAVIS_PHP_VERSION != nightly ]]; then phpenv config-rm xdebug.ini; fi
  - if [[ $TRAVIS_PHP_VERSION == nightly ]]; then rm composer.lock; fi
  - composer install --ignore-platform-reqs

script:
  - ./vendor/bin/phpunit --color=always --coverage-text

allow_failures:
  - php: nightly

jobs:
  include:

    - stage: Code style
      php: 7.4
      script:
        - ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run
        - ./vendor/bin/phpcs
