Add pjson support

This commit is contained in:
2024-06-29 11:46:16 -04:00
parent 50854275a8
commit 478684621c
8 changed files with 146 additions and 12 deletions

23
tests/PjsonId.php Normal file
View File

@@ -0,0 +1,23 @@
<?php declare(strict_types=1);
namespace Test;
use Square\Pjson\JsonDataSerializable;
/**
* A serializable ID wrapper class
*/
class PjsonId implements JsonDataSerializable
{
public function __construct(protected string $value) { }
public function toJsonData(): string
{
return $this->value;
}
public static function fromJsonData($jd, array|string $path = []): static
{
return new static($jd);
}
}