Skip to content

Commit 284fa24

Browse files
committed
Support PHP-8.1
1 parent 7bccc3e commit 284fa24

File tree

4 files changed

+15
-26
lines changed

4 files changed

+15
-26
lines changed

.travis.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ cache:
66
- $HOME/.composer/cache
77
- $HOME/.local
88
- $HOME/ocular.phar
9-
- $HOME/phpDocumentor.phar
109

1110
env:
1211
global:
1312
- CODE_COVERAGE="0"
14-
- PHPDOC="0"
1513

1614
matrix:
1715
fast_finish: true
@@ -22,7 +20,6 @@ matrix:
2220
- php: 7.0
2321
env:
2422
- CODE_COVERAGE="1"
25-
- PHPDOC="1"
2623
- php: 7.1
2724
env:
2825
- CODE_COVERAGE="1"
@@ -32,6 +29,15 @@ matrix:
3229
- php: 7.3
3330
env:
3431
- CODE_COVERAGE="1"
32+
- php: 7.4
33+
env:
34+
- CODE_COVERAGE="1"
35+
- php: 8.0
36+
env:
37+
- CODE_COVERAGE="1"
38+
- php: 8.1
39+
env:
40+
- CODE_COVERAGE="1"
3541
- php: nightly
3642

3743
# HHVM is no longer supported on Ubuntu Precise. Please consider using Trusty with `dist: trusty`.
@@ -49,10 +55,6 @@ install:
4955
- if [ "${CODE_COVERAGE}" == "1" ]; then
5056
wget -q -N -t 3 --retry-connrefused 'https://scrutinizer-ci.com/ocular.phar' || return 0;
5157
fi
52-
- if [ "${PHPDOC}" == "1" ]; then
53-
wget -q -N -t 3 --retry-connrefused 'https://github.com/phpDocumentor/phpDocumentor2/releases/download/v2.9.0/phpDocumentor.phar' || return 0;
54-
composer require --no-update --dev "evert/phpdoc-md:~0.2.0" || return 0;
55-
fi
5658
- composer install -n
5759

5860
script:
@@ -66,16 +68,6 @@ after_script:
6668
- if [ "${CODE_COVERAGE}" == "1" ]; then
6769
php ocular.phar code-coverage:upload --format=php-clover coverage.clover;
6870
fi
69-
- if [ "${PHPDOC}" == "1" ]; then
70-
git clone "https://${CI_USER_TOKEN}@github.com/marc-mabe/php-enum.wiki.git" &&
71-
php phpDocumentor.phar -d src -t docs/ --template="xml" &&
72-
php vendor/bin/phpdocmd --lt '%c' --index 'Home.md' docs/structure.xml php-enum.wiki/ &&
73-
cp php-enum.wiki/Home.md php-enum.wiki/_Sidebar.md &&
74-
cd php-enum.wiki/ &&
75-
git add . &&
76-
git commit -m "auto generated PHP doc" &&
77-
git push origin master:master;
78-
fi
7971

8072
notifications:
8173
email: false

src/Enum.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function __toString()
7777
* @throws LogicException Enums are not cloneable
7878
* because instances are implemented as singletons
7979
*/
80-
final private function __clone()
80+
final public function __clone()
8181
{
8282
throw new LogicException('Enums are not cloneable');
8383
}
@@ -299,7 +299,7 @@ final public static function getNames()
299299
}
300300
return self::$names[static::class];
301301
}
302-
302+
303303
/**
304304
* Get a list of enumerator ordinal numbers
305305
*
@@ -324,7 +324,7 @@ final public static function getConstants()
324324

325325
/**
326326
* Test if the given enumerator is part of this enumeration
327-
*
327+
*
328328
* @param static|null|bool|int|float|string|array $enumerator
329329
* @return bool
330330
*/

tests/MabeEnumTest/EnumTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public function testGetNamesConstantsNotDetected()
233233
$this->assertSame($expectedNames[$i], $names[$i]);
234234
}
235235
}
236-
236+
237237
public function testGetOrdinals()
238238
{
239239
$constants = EnumInheritance::getConstants();
@@ -364,12 +364,10 @@ public function testCloneNotCallableAndThrowsLogicException()
364364

365365
$reflectionClass = new ReflectionClass($enum);
366366
$reflectionMethod = $reflectionClass->getMethod('__clone');
367-
$this->assertTrue($reflectionMethod->isPrivate(), 'The method __clone must be private');
368367
$this->assertTrue($reflectionMethod->isFinal(), 'The method __clone must be final');
369368

370-
$reflectionMethod->setAccessible(true);
371369
$this->expectException(LogicException::class);
372-
$reflectionMethod->invoke($enum);
370+
clone $enum;
373371
}
374372

375373
public function testNotSerializable()
@@ -430,7 +428,7 @@ public function testConstVisibility()
430428
'PUB' => ConstVisibilityEnum::PUB,
431429
), $constants);
432430
}
433-
431+
434432
public function testConstVisibilityExtended()
435433
{
436434
if (PHP_VERSION_ID < 70100) {

tests/bootstrap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
assert_options(ASSERT_ACTIVE, 1);
1616
assert_options(ASSERT_WARNING, 0);
1717
assert_options(ASSERT_BAIL, 0);
18-
assert_options(ASSERT_QUIET_EVAL, 0);
1918
if (!class_exists('AssertionError')) {
2019
// AssertionError has been added in PHP-7.0
2120
class AssertionError extends Exception {};

0 commit comments

Comments
 (0)