| language: php
sudo: false
cache:
  directories:
    - $HOME/.composer/cache
dist: trusty
branches:
  only:
    - master
git:
  depth: 5
services:
  - mysql
test:
  adapter:  mysql2
  database: phpunit
  username: travis
  encoding: utf8
php:
  - 5.6
  - 7.0
  - 7.1
  - 7.2
  - hhvm
  - nightly
  
matrix:
  fast_finish: true
  include:
    - php: 7.1
      env: PHPCS=PSR2
  allow_failures:
    - php: nightly
before_script:
  - mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
  - mysql -e 'CREATE DATABASE phpunit;'
  - export PATH="./vendor/bin:$PATH"
  - travis_retry composer self-update
  - travis_retry composer install --no-interaction --prefer-source --dev
script:
  - phpunit
  - |
    if [[ "$PHPCS" ]] ; then
      phpcs --standard=phpcs.xml $(find . -name '*.php')
      phpmd src,tests text ./phpmd.xml
    fi
after_success:
 - bash <(curl -s https://codecov.io/bash)
 |