File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
src/Illuminate/Collections/Traits Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -961,15 +961,12 @@ public function toArray()
961961 public function jsonSerialize (): array
962962 {
963963 return array_map (function ($ value ) {
964- if ($ value instanceof JsonSerializable) {
965- return $ value ->jsonSerialize ();
966- } elseif ($ value instanceof Jsonable) {
967- return json_decode ($ value ->toJson (), true );
968- } elseif ($ value instanceof Arrayable) {
969- return $ value ->toArray ();
970- }
971-
972- return $ value ;
964+ return match (true ) {
965+ $ value instanceof JsonSerializable => $ value ->jsonSerialize (),
966+ $ value instanceof Jsonable => json_decode ($ value ->toJson (), true ),
967+ $ value instanceof Arrayable => $ value ->toArray (),
968+ default => $ value ,
969+ };
973970 }, $ this ->all ());
974971 }
975972
You can’t perform that action at this time.
0 commit comments