language: php

sudo: false

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

php:
    - 5.4
    - 5.5
    - 5.6
    - 7.0
    - 7.1
    - 7.2
    - nightly

env:
    - TWIG_EXT=no

before_install:
    # turn off XDebug
    - phpenv config-rm xdebug.ini || return 0

install:
    - travis_retry composer install

before_script:
    - if [ "$TWIG_EXT" == "yes" ]; then sh -c "cd ext/twig && phpize && ./configure --enable-twig && make && make install"; fi
    - if [ "$TWIG_EXT" == "yes" ]; then echo "extension=twig.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi

script: |
    if [[ $TRAVIS_PHP_VERSION = 7.* || $TRAVIS_PHP_VERSION = nightly ]]; then
        SYMFONY_PHPUNIT_VERSION=6.1 ./vendor/bin/simple-phpunit
    else
        ./vendor/bin/simple-phpunit
    fi

matrix:
    fast_finish: true
    include:
        - php: 5.3
          dist: precise
          env: TWIG_EXT=yes
        - php: 5.3
          dist: precise
          env: TWIG_EXT=no
        - php: 5.4
          env: TWIG_EXT=yes
        - php: 5.5
          env: TWIG_EXT=yes
        - php: 5.6
          env: TWIG_EXT=yes
