Add clone() Method
This commit is contained in:
@@ -6,5 +6,5 @@ namespace Potter\Cloneable;
|
|||||||
|
|
||||||
abstract class AbstractCloneable implements CloneableInterface
|
abstract class AbstractCloneable implements CloneableInterface
|
||||||
{
|
{
|
||||||
|
abstract public function clone(): CloneableInterface;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ namespace Potter\Cloneable;
|
|||||||
|
|
||||||
interface CloneableInterface
|
interface CloneableInterface
|
||||||
{
|
{
|
||||||
|
public function clone(): self;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,8 @@ namespace Potter\Cloneable;
|
|||||||
|
|
||||||
trait CloneableTrait
|
trait CloneableTrait
|
||||||
{
|
{
|
||||||
|
final public function clone(): CloneableInterface
|
||||||
|
{
|
||||||
|
return clone $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user