Make tokens stringable

This commit is contained in:
Andrea Marco Sartori 2022-10-29 18:33:28 +10:00
parent 2ec4bbe58b
commit 94667ba3e3

View File

@ -3,12 +3,13 @@
namespace Cerbero\JsonParser\Tokens; namespace Cerbero\JsonParser\Tokens;
use Cerbero\JsonParser\State; use Cerbero\JsonParser\State;
use Stringable;
/** /**
* The abstract implementation of a token. * The abstract implementation of a token.
* *
*/ */
abstract class Token abstract class Token implements Stringable
{ {
/** /**
* The token value. * The token value.
@ -77,4 +78,14 @@ abstract class Token
{ {
return false; return false;
} }
/**
* Retrieve the underlying token value
*
* @return string
*/
public function __toString(): string
{
return $this->value;
}
} }