implement Potter\Cloneable

This commit is contained in:
2026-03-20 18:33:25 -04:00
parent 9356bf990e
commit eb593180f8
4 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace Potter\Cloneable;
use \Potter\Template\Template;
abstract class AbstractCloneable extends Template implements CloneableInterface
{
abstract public function clone(): static;
abstract public function __clone(): void;
}

View File

@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Potter\Cloneable;
abstract class Cloneable extends AbstractCloneable
{
use CloneableTrait;
}

View File

@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace Potter\Cloneable;
use \Potter\Template\TemplateInterface;
interface CloneableInterface extends TemplateInterface
{
public function clone(): static;
public function __clone(): void;
}

View File

@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace Potter\Cloneable;
trait CloneableTrait
{
public function clone(): static
{
return clone $this;
}
public function __clone(): void
{ }
}