Skip to content

Commit bf2692b

Browse files
committed
final modifier for private method is no longer allowed in PHP8
1 parent e495d99 commit bf2692b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/Enum.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ abstract class Enum
6060
* @param null|bool|int|float|string|array<mixed> $value The value of the enumerator
6161
* @param int|null $ordinal The ordinal number of the enumerator
6262
*/
63-
final private function __construct($value, $ordinal = null)
63+
private function __construct($value, $ordinal = null)
6464
{
6565
$this->value = $value;
6666
$this->ordinal = $ordinal;
@@ -81,7 +81,7 @@ public function __toString(): string
8181
* @throws LogicException Enums are not cloneable
8282
* because instances are implemented as singletons
8383
*/
84-
final private function __clone()
84+
private function __clone()
8585
{
8686
throw new LogicException('Enums are not cloneable');
8787
}

tests/MabeEnumTest/EnumTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ public function testCloneNotCallableAndThrowsLogicException(): void
377377
$reflectionClass = new ReflectionClass($enum);
378378
$reflectionMethod = $reflectionClass->getMethod('__clone');
379379
$this->assertTrue($reflectionMethod->isPrivate(), 'The method __clone must be private');
380-
$this->assertTrue($reflectionMethod->isFinal(), 'The method __clone must be final');
381380

382381
$reflectionMethod->setAccessible(true);
383382
$this->expectException(LogicException::class);

0 commit comments

Comments
 (0)