Skip to content

Commit

Permalink
Implement JsonSerializable
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Oct 17, 2016
1 parent 0b920c4 commit b44a78b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/BigNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Common interface for arbitrary-precision rational numbers.
*/
abstract class BigNumber implements \Serializable
abstract class BigNumber implements \Serializable, \JsonSerializable
{
/**
* The regular expression used to parse integer, decimal and rational numbers.
Expand Down Expand Up @@ -395,4 +395,12 @@ abstract public function toFloat();
* @return string
*/
abstract public function __toString();

/**
* {@inheritdoc}
*/
public function jsonSerialize()
{
return $this->__toString();
}
}

0 comments on commit b44a78b

Please sign in to comment.