From e116c090ed804855dbac4a1bbee283e11f580025 Mon Sep 17 00:00:00 2001 From: Pierre Tondereau Date: Mon, 5 Oct 2020 20:41:15 +0200 Subject: [PATCH] Add PHP8 support. --- .travis.yml | 13 +++++++++---- composer.json | 2 +- tests/Assert/Tests/AssertTest.php | 8 ++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index f551481d..fe9f2614 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,10 @@ matrix: - php: 7.1 - php: 7.2 - php: 7.3 - - php: 7.3.0 - - php: 7.3.1 - - php: 7.3.2 + - php: 7.4 - php: nightly + env: + - IGNORE_PLATFORM_REQ=true - php: hhvm-3.9 sudo: required dist: trusty @@ -36,7 +36,12 @@ before_install: - xdebug-disable before_script: - - travis_retry composer update --no-interaction --prefer-source --prefer-stable + - if [[ "$IGNORE_PLATFORM_REQ" == "true" ]]; then + composer self-update --preview; + travis_retry composer update --no-interaction --prefer-stable --ignore-platform-req=php; + else + travis_retry composer update --no-interaction --prefer-stable; + fi script: - if [[ "$LINT" == "true" ]]; then diff --git a/composer.json b/composer.json index 619b8e27..cc326282 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "sort-packages": true }, "require": { - "php": "^7", + "php": "^7.0 || ^8.0", "ext-intl": "*", "ext-simplexml": "*", "ext-mbstring": "*", diff --git a/tests/Assert/Tests/AssertTest.php b/tests/Assert/Tests/AssertTest.php index 8f4d3fea..f55885d1 100644 --- a/tests/Assert/Tests/AssertTest.php +++ b/tests/Assert/Tests/AssertTest.php @@ -1832,7 +1832,11 @@ public function testValidCallable() { $this->assertTrue(Assertion::isCallable('\is_callable')); $this->assertTrue(Assertion::isCallable(__NAMESPACE__.'\\Fixtures\\someCallable')); - $this->assertTrue(Assertion::isCallable([OneCountable::class, 'count'])); + if (PHP_VERSION_ID >= 70400) { + $this->assertTrue(Assertion::isCallable([new OneCountable(), 'count'])); + } else { + $this->assertTrue(Assertion::isCallable([OneCountable::class, 'count'])); + } $this->assertTrue( Assertion::isCallable( function () { @@ -2227,7 +2231,7 @@ public function testInvalidPropertiesExist($properties) public function testIsResource() { - self::assertTrue(Assertion::isResource(\curl_init())); + self::assertTrue(Assertion::isResource(\finfo_open())); } /**