From 87d6a06dbcd5c9fcc3f289011b14a71279c76033 Mon Sep 17 00:00:00 2001 From: Ricardo Gobbo de Souza Date: Thu, 17 Aug 2023 10:49:49 -0300 Subject: [PATCH] Remove `Renderable` --- src/Money.php | 17 +++-------------- tests/MoneyTest.php | 1 - 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/Money.php b/src/Money.php index 091db1f..4c32e1c 100644 --- a/src/Money.php +++ b/src/Money.php @@ -4,7 +4,6 @@ use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Support\Jsonable; -use Illuminate\Contracts\Support\Renderable; use Illuminate\Support\Traits\Macroable; use JsonSerializable; use ReflectionMethod; @@ -37,7 +36,7 @@ * @method static Money sum(Money|\Money\Money $first, Money|\Money\Money ...$collection) * @method static Money avg(Money|\Money\Money $first, Money|\Money\Money ...$collection) */ -class Money implements Arrayable, Jsonable, JsonSerializable, Renderable +class Money implements Arrayable, Jsonable, JsonSerializable { use CurrenciesTrait; use LocaleTrait; @@ -149,7 +148,7 @@ public function jsonSerialize() return array_merge( $this->attributes, $this->money->jsonSerialize(), - ['formatted' => $this->render()] + ['formatted' => $this->format()] ); } @@ -174,16 +173,6 @@ public function toJson($options = 0) return json_encode($this->toArray(), $options); } - /** - * Get the evaluated contents of the object. - * - * @return string - */ - public function render() - { - return $this->format(); - } - /** * __toString. * @@ -191,7 +180,7 @@ public function render() */ public function __toString() { - return $this->render(); + return $this->format(); } /** diff --git a/tests/MoneyTest.php b/tests/MoneyTest.php index 3d1fa1b..b0c6fa5 100644 --- a/tests/MoneyTest.php +++ b/tests/MoneyTest.php @@ -195,7 +195,6 @@ public function testGetters() static::assertJson($money->toJson()); static::assertEquals($money->toArray(), $actual); static::assertEquals($money->jsonSerialize(), $actual); - static::assertEquals('$1.00', $money->render()); static::assertEquals('$1.00', $money); }