Add clone() Method

This commit is contained in:
2025-10-25 11:52:31 -04:00
parent 577b2d3eeb
commit ee67a82f64
3 changed files with 6 additions and 3 deletions

View File

@@ -6,5 +6,5 @@ namespace Potter\Cloneable;
abstract class AbstractCloneable implements CloneableInterface abstract class AbstractCloneable implements CloneableInterface
{ {
abstract public function clone(): CloneableInterface;
} }

View File

@@ -6,5 +6,5 @@ namespace Potter\Cloneable;
interface CloneableInterface interface CloneableInterface
{ {
public function clone(): self;
} }

View File

@@ -6,5 +6,8 @@ namespace Potter\Cloneable;
trait CloneableTrait trait CloneableTrait
{ {
final public function clone(): CloneableInterface
{
return clone $this;
}
} }