diff --git a/.travis.yml b/.travis.yml index 5e69d79..2f2f25c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ php: - 7.1 - 7.2 - 7.3 + - 7.4 - hhvm - nightly diff --git a/Makefile b/Makefile index 93f0b0c..ee0539b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ test: test-phpunit test-phpunit: - PHP_VERSION=7.3 docker-compose run --rm php php -v && php vendor/bin/phpunit --coverage-text + PHP_VERSION=7.4 docker-compose run --rm php php -v + PHP_VERSION=7.4 docker-compose run --rm php php vendor/bin/phpunit --coverage-text test-phpunit-local: php -v php vendor/bin/phpunit --coverage-text @@ -9,7 +10,8 @@ travis: PHP_VERSION=7.1 make travis-job PHP_VERSION=7.2 make travis-job PHP_VERSION=7.3 make travis-job - PHP_VERSION=7.3 docker-compose run --rm composer composer config --unset platform + PHP_VERSION=7.4 make travis-job + PHP_VERSION=7.4 docker-compose run --rm composer composer config --unset platform travis-job: docker-compose run --rm composer composer config platform.php ${PHP_VERSION} docker-compose run --rm composer composer update -q diff --git a/composer.json b/composer.json index 8cd62c5..1f31a9a 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "php": "^7.1" + "php": "^7.1|^8.0" }, "require-dev": { "ext-json": "*", diff --git a/src/Enum/EnumTrait.php b/src/Enum/EnumTrait.php index a2c82e7..416b3e8 100644 --- a/src/Enum/EnumTrait.php +++ b/src/Enum/EnumTrait.php @@ -210,7 +210,9 @@ final private static function resolveMembers(): void return; } - if(false === method_exists($class, 'resolve')) { + // reflection instead of method_exists because of PHP 7.4 bug #78632 + // @see https://bugs.php.net/bug.php?id=78632 + if(false === (new \ReflectionClass($class))->hasMethod('resolve')) { throw PlatenumException::fromMissingResolve($class); } $members = static::resolve(); diff --git a/src/Enum/StaticEnumTrait.php b/src/Enum/StaticEnumTrait.php index 17a760d..cf8e7fa 100644 --- a/src/Enum/StaticEnumTrait.php +++ b/src/Enum/StaticEnumTrait.php @@ -14,7 +14,9 @@ trait StaticEnumTrait final private static function resolve(): array { $class = static::class; - if(false === property_exists($class, 'mapping')) { + // reflection instead of property_exists because of PHP 7.4 bug #78632 + // @see https://bugs.php.net/bug.php?id=78632 + if(false === (new \ReflectionClass($class))->hasProperty('mapping')) { throw PlatenumException::fromMissingMappingProperty($class); }