Implement StringableInterface
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
"name": "potter/renderable",
|
"name": "potter/renderable",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.4"
|
"php": "^8.4",
|
||||||
|
"potter/stringable": "dev-main"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Potter\Renderable;
|
namespace Potter\Renderable;
|
||||||
|
|
||||||
interface RenderableInterface
|
use \Potter\Stringable\StringableInterface;
|
||||||
|
|
||||||
|
interface RenderableInterface extends StringableInterface
|
||||||
{
|
{
|
||||||
public function render(): string;
|
public function render(): string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,10 @@ namespace Potter\Renderable;
|
|||||||
|
|
||||||
trait RenderableTrait
|
trait RenderableTrait
|
||||||
{
|
{
|
||||||
|
final public function __toString(): string
|
||||||
|
{
|
||||||
|
return $this->render();
|
||||||
|
}
|
||||||
|
|
||||||
abstract public function render(): string;
|
abstract public function render(): string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user