From df8022c495c69d0a49cef5dc6f17ed35684b0b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Thu, 4 Mar 2021 17:25:04 +0100 Subject: [PATCH] Change ToJson on Base Enum --- changelog.md | 7 ++++++- src/BaseEnum.php | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 3b0a473..5e7e924 100644 --- a/changelog.md +++ b/changelog.md @@ -30,4 +30,9 @@ All notable changes to `Enum` will be documented in this file. ## Version 0.1.1 ### Fixed - - fixed performances issue on toValues and toLabels \ No newline at end of file + - fixed performances issue on toValues and toLabels + +## Version 0.1.2 + +### Changed + - changed toJson to output array with label and value diff --git a/src/BaseEnum.php b/src/BaseEnum.php index 617c8d1..769e9d2 100644 --- a/src/BaseEnum.php +++ b/src/BaseEnum.php @@ -267,7 +267,10 @@ abstract class BaseEnum implements JsonSerializable, UrlRoutable */ public function jsonSerialize() { - return $this->value; + return [ + 'value' => $this->value, + 'label' => $this->label + ]; } public function __toString(): string