mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
Bugfixes
- Fixed `Url` not outputting correct class when used in json_encode. - Fixed `IInputItem` being too strict about strings which may be nullable.
This commit is contained in:
+14
-2
@@ -4,7 +4,7 @@ namespace Pecee\Http;
|
||||
|
||||
use Pecee\Http\Exceptions\MalformedUrlException;
|
||||
|
||||
class Url
|
||||
class Url implements \JsonSerializable
|
||||
{
|
||||
private $originalUrl;
|
||||
|
||||
@@ -441,7 +441,19 @@ class Url
|
||||
return $scheme . $user . $pass . $host . $port . $this->getRelativeUrl();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
/**
|
||||
* Specify data which should be serialized to JSON
|
||||
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
* @return mixed data which can be serialized by <b>json_encode</b>,
|
||||
* which is a value of any type other than a resource.
|
||||
* @since 5.4.0
|
||||
*/
|
||||
public function jsonSerialize(): string
|
||||
{
|
||||
return $this->getRelativeUrl();
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getRelativeUrl();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user