Skip to content

Commit 3a43735

Browse files
authored
Merge pull request #147 from shmurakami/remove-final-from-private
final modifier for private method is no longer allowed in PHP8
2 parents 57b9799 + e99fc17 commit 3a43735

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Enum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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+
final protected function __clone()
8585
{
8686
throw new LogicException('Enums are not cloneable');
8787
}

tests/MabeEnumTest/EnumTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public function testGetNamesConstantsNotDetected(): void
245245
$this->assertSame($expectedNames[$i], $names[$i]);
246246
}
247247
}
248-
248+
249249
public function testGetOrdinals(): void
250250
{
251251
$constants = EnumInheritance::getConstants();
@@ -376,7 +376,7 @@ public function testCloneNotCallableAndThrowsLogicException(): void
376376

377377
$reflectionClass = new ReflectionClass($enum);
378378
$reflectionMethod = $reflectionClass->getMethod('__clone');
379-
$this->assertTrue($reflectionMethod->isPrivate(), 'The method __clone must be private');
379+
$this->assertTrue($reflectionMethod->isProtected(), 'The method __clone must be protected');
380380
$this->assertTrue($reflectionMethod->isFinal(), 'The method __clone must be final');
381381

382382
$reflectionMethod->setAccessible(true);
@@ -432,7 +432,7 @@ public function testConstVisibility(): void
432432
'PUB' => ConstVisibilityEnum::PUB,
433433
), $constants);
434434
}
435-
435+
436436
public function testConstVisibilityExtended(): void
437437
{
438438
$constants = ConstVisibilityEnumExtended::getConstants();

0 commit comments

Comments
 (0)