File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff 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- private function __clone ()
84+ final protected function __clone ()
8585 {
8686 throw new LogicException ('Enums are not cloneable ' );
8787 }
Original file line number Diff line number Diff 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,8 @@ 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 ' );
380+ $ this ->assertTrue ($ reflectionMethod ->isFinal (), 'The method __clone must be final ' );
380381
381382 $ reflectionMethod ->setAccessible (true );
382383 $ this ->expectException (LogicException::class);
@@ -431,7 +432,7 @@ public function testConstVisibility(): void
431432 'PUB ' => ConstVisibilityEnum::PUB ,
432433 ), $ constants );
433434 }
434-
435+
435436 public function testConstVisibilityExtended (): void
436437 {
437438 $ constants = ConstVisibilityEnumExtended::getConstants ();
You can’t perform that action at this time.
0 commit comments