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