Skip to content

Commit b93dd64

Browse files
committed
Merge branch 'backport/98' into 2.x
2 parents 9803f7f + e627ae7 commit b93dd64

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

.travis.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ env:
1616
matrix:
1717
fast_finish: true
1818
include:
19-
- php: 5.3.3
20-
- php: 5.3
2119
- php: 5.4
2220
env:
2321
- CODE_COVERAGE="1"
@@ -29,12 +27,13 @@ matrix:
2927
- php: 7.1
3028
env:
3129
- CODE_COVERAGE="1"
32-
- php: nightly
33-
- php: hhvm
34-
# HHVM is no longer supported on Ubuntu Precise. Please consider using Trusty with `dist: trusty`.
30+
- php: 7.2
31+
- php: 7.3
32+
# HHVM is no longer supported on Ubuntu Precise. Please consider using Trusty with `dist: trusty`.
33+
- php: hhvm-3.27 # LTS
34+
dist: trusty
35+
- php: hhvm-3.30 # last with PHP support
3536
dist: trusty
36-
allow_failures:
37-
- php: nightly
3837

3938
install:
4039
- if [ "${CODE_COVERAGE}" == "0" ]; then

src/Enum.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,11 @@ private static function detectConstants($class)
378378

379379
do {
380380
$scopeConstants = array();
381-
if (PHP_VERSION_ID >= 70100) {
381+
if (\PHP_VERSION_ID >= 70100 && method_exists('ReflectionClass', 'getReflectionConstants')) {
382382
// Since PHP-7.1 visibility modifiers are allowed for class constants
383383
// for enumerations we are only interested in public once.
384+
// NOTE: HHVM > 3.26.2 still does not support private/protected constants.
385+
// It allows the visibility keyword but ignores it.
384386
foreach ($reflection->getReflectionConstants() as $reflConstant) {
385387
if ($reflConstant->isPublic()) {
386388
$scopeConstants[ $reflConstant->getName() ] = $reflConstant->getValue();

tests/MabeEnumTest/EnumTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ public function testConstVisibility()
297297
if (PHP_VERSION_ID < 70100) {
298298
$this->markTestSkipped('This test is for PHP-7.1 and upper only');
299299
}
300+
if (defined('HHVM_VERSION')) {
301+
$this->markTestSkipped('HHVM does not support constant visibility');
302+
}
300303

301304
$constants = ConstVisibilityEnum::getConstants();
302305
$this->assertSame(array(
@@ -310,6 +313,9 @@ public function testConstVisibilityExtended()
310313
if (PHP_VERSION_ID < 70100) {
311314
$this->markTestSkipped('This test is for PHP-7.1 and upper only');
312315
}
316+
if (defined('HHVM_VERSION')) {
317+
$this->markTestSkipped('HHVM does not support constant visibility');
318+
}
313319

314320
$constants = ConstVisibilityEnumExtended::getConstants();
315321
$this->assertSame(array(

0 commit comments

Comments
 (0)