Skip to content

Commit

Permalink
[9.x] Allow jsonSerialize() to return other types (#42133)
Browse files Browse the repository at this point in the history
* Update jsonSerialized() return to type to mixed

* Update testJsonSerialize test

* Update to use a more specific type: array|string vs. mixed

* Typo - missing bracket

* Updated Collection's jsonSerialize return type to be array

* Revert EnumeratesValues' jsonSerialize() type

* Revert to mixed type
  • Loading branch information
mikewuu authored Apr 27, 2022
1 parent b1394d0 commit fe01076
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1539,9 +1539,9 @@ public function toJson($options = 0)
/**
* Convert the object into something JSON serializable.
*
* @return array
* @return mixed
*/
public function jsonSerialize(): array
public function jsonSerialize(): mixed
{
return $this->toArray();
}
Expand Down

0 comments on commit fe01076

Please sign in to comment.