sudo: false

language: php

php:
- "7.1"
- "7.2"
- "7.3"

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

env:
  matrix:
  - DEPENDENCIES=latest
  - DEPENDENCIES=oldest

before_install:
- phpenv config-rm xdebug.ini || echo "xdebug not available"

install:
- >
  echo;
  if [ "$DEPENDENCIES" = "latest" ]; then
    echo "Installing the latest dependencies";
    composer update --with-dependencies
  else
    echo "Installing the lowest dependencies";
    composer update --with-dependencies --prefer-lowest
  fi;
  composer show;

script:
- >
  echo;
  echo "Validating the composer.json";
  composer validate --no-check-all --no-check-lock --strict;

- >
  echo;
  echo "Linting all PHP files";
  composer ci:lint;

- >
  echo;
  echo "Running the Psalm static analyzer";
  composer ci:psalm;

- >
  echo;
  echo "Running the PHPUnit tests";
  composer ci:tests;

- >
  echo;
  echo "Running PHP_CodeSniffer";
  composer ci:sniff;

sudo: false

language: php

php:
- "7.1"
- "7.2"
- "7.3"

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

env:
  matrix:
  - DEPENDENCIES=latest
  - DEPENDENCIES=oldest

before_install:
- phpenv config-rm xdebug.ini || echo "xdebug not available"

install:
- >
  echo;
  if [ "$DEPENDENCIES" = "latest" ]; then
    echo "Installing the latest dependencies";
    composer update --with-dependencies
  else
    echo "Installing the lowest dependencies";
    composer update --with-dependencies --prefer-lowest
  fi;
  composer show;

script:
- >
  echo;
  echo "Validating the composer.json";
  composer validate --no-check-all --no-check-lock --strict;

- >
  echo;
  echo "Linting all PHP files";
  composer ci:lint;

- >
  echo;
  echo "Running the Psalm static analyzer";
  composer ci:psalm;

- >
  echo;
  echo "Running the PHPUnit tests";
  composer ci:tests;

- >
  echo;
  echo "Running PHP_CodeSniffer";
  composer ci:sniff;

Stop caching vendor/ on Travis CI
[BUGFIX] Stop caching vendor/ on Travis CI

Caching this directory creates problems between builds with different
PHP versions and highest/lowest dependencies.

Caching the Composer cache directory should suffice to not download
the packages.
