Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/Postcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function split()
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return (string) $this->normalise();
}
Expand Down Expand Up @@ -346,13 +346,32 @@ public function unserialize($serialized)
return $this->value;
}

/**
* Generates a storable representation of a value
*
*/
public function __serialize(): array
{
return [$this->value];
}

/**
* Creates a PHP value from a stored representation
*
*/
public function __unserialize(array $serialized): void
{
$this->value = $serialized[0];
}


/**
* Specify data which should be serialized to JSON
*
* @return mixed data which can be serialized by <b>json_encode</b>,
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return [
Expand Down