language: php

matrix:
  include:
    - name: "PHP 5.4"
      php: "5.4"
    - name: "PHP 5.4 (Prefer Lowest Dependency Version)"
      php: "5.4"
      env: COMPOSER_ARGS="--prefer-lowest"

    - name: "PHP 5.5"
      php: "5.5"
    - name: "PHP 5.5 (Prefer Lowest Dependency Version)"
      php: "5.5"
      env: COMPOSER_ARGS="--prefer-lowest"

    - name: "PHP 5.6"
      php: "5.6"
    - name: "PHP 5.6 (Prefer Lowest Dependency Version)"
      php: "5.6"
      env: COMPOSER_ARGS="--prefer-lowest"

    - name: "PHP 7.0"
      php: "7.0"
    - name: "PHP 7.0 (Prefer Lowest Dependency Version)"
      php: "7.0"
      env: COMPOSER_ARGS="--prefer-lowest"

    - name: "PHP 7.1"
      php: "7.1"
    - name: "PHP 7.1 (Prefer Lowest Dependency Version)"
      php: "7.1"
      env: COMPOSER_ARGS="--prefer-lowest"

    - name: "PHP 7.2"
      php: "7.2"
    - name: "PHP 7.2 (Prefer Lowest Dependency Version)"
      php: "7.2"
      env: COMPOSER_ARGS="--prefer-lowest"

    - name: "PHP 7.3"
      php: "7.3"

    - name: "Check Style"
      php: "7.3"
      env: RUN_CS_FIXER=true

before_script:
  - composer update $COMPOSER_ARGS

script:
  - if [ "${RUN_CS_FIXER}" = "true" ]; then
      vendor/bin/php-cs-fixer fix --dry-run --diff --config-file=.php_cs .;
    else
      vendor/bin/phpunit;
    fi
