diff --git a/.travis.yml b/.travis.yml index da82445..6af5f34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,14 +8,6 @@ cache: directories: - $HOME/.composer/cache/files -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - hhvm - env: global: - TEST_COMMAND="composer test" @@ -27,18 +19,47 @@ branches: matrix: fast_finish: true include: + - php: 7.1 + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" DEPENDENCIES="doctrine/instantiator:^1.1" + + # Test the latest stable release - php: 5.4 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci" + - php: 5.5 + - php: 5.6 + - php: 7.0 + - php: 7.1 + - php: 7.2 + env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="henrikbjorn/phpspec-code-coverage:^1.0" + + # Test LTS versions + - php: 7.1 + env: DEPENDENCIES="dunglas/symfony-lock:^2" + - php: 7.1 + env: DEPENDENCIES="dunglas/symfony-lock:^3" + - php: 7.1 + env: DEPENDENCIES="dunglas/symfony-lock:^4" STABILITY="rc" + + # Latest dev release + - php: 7.1 + env: STABILITY="dev" + allow_failures: + # Latest dev is allowed to fail. + - env: STABILITY="dev" + before_install: - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi + - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi; + - if ! [ -z "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi; install: + - cat composer.json # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355 - - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi - - travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction + - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi + - composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction script: + - composer validate --strict --no-check-lock - $TEST_COMMAND after_success: diff --git a/composer.json b/composer.json index c2c9ec4..fc5fc5f 100644 --- a/composer.json +++ b/composer.json @@ -11,15 +11,14 @@ } ], "require": { - "php": ">=5.4", + "php": "^5.4 || ^7.0", "php-http/httplug": "^1.1", "php-http/message-factory": "^1.0", "php-http/message": "^1.6", "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.4", - "henrikbjorn/phpspec-code-coverage" : "^1.0", + "phpspec/phpspec": "^2.5 || ^3.4 || ^4.2", "guzzlehttp/psr7": "^1.4" }, "suggest": { diff --git a/src/Plugin/ContentTypePlugin.php b/src/Plugin/ContentTypePlugin.php index 2390ca6..8ef1d62 100644 --- a/src/Plugin/ContentTypePlugin.php +++ b/src/Plugin/ContentTypePlugin.php @@ -102,7 +102,7 @@ private function isJson($stream) json_decode($stream->getContents()); - return JSON_ERROR_NONE == json_last_error(); + return JSON_ERROR_NONE === json_last_error(); } /**