Implement StringableInterface

This commit is contained in:
2025-10-25 14:59:18 -04:00
parent 8f43a0e823
commit 3dc5e104f1
3 changed files with 10 additions and 2 deletions

View File

@@ -2,7 +2,8 @@
"name": "potter/renderable",
"type": "library",
"require": {
"php": "^8.4"
"php": "^8.4",
"potter/stringable": "dev-main"
},
"license": "MIT",
"autoload": {

View File

@@ -4,7 +4,9 @@ declare(strict_types=1);
namespace Potter\Renderable;
interface RenderableInterface
use \Potter\Stringable\StringableInterface;
interface RenderableInterface extends StringableInterface
{
public function render(): string;
}

View File

@@ -6,5 +6,10 @@ namespace Potter\Renderable;
trait RenderableTrait
{
final public function __toString(): string
{
return $this->render();
}
abstract public function render(): string;
}