Define a global lazy pointer when cloning the config

This commit is contained in:
Andrea Marco Sartori 2023-03-20 19:23:02 +10:00
parent 4212f20149
commit f930423627

View File

@ -8,6 +8,7 @@ use Cerbero\JsonParser\Decoders\Decoder;
use Cerbero\JsonParser\Decoders\SimdjsonDecoder;
use Cerbero\JsonParser\Exceptions\DecodingException;
use Cerbero\JsonParser\Exceptions\SyntaxException;
use Cerbero\JsonParser\Pointers\Pointer;
use Cerbero\JsonParser\Pointers\Pointers;
use Closure;
@ -63,4 +64,15 @@ final class Config
$this->onDecodingError = fn (DecodedValue $decoded) => throw new DecodingException($decoded);
$this->onSyntaxError = fn (SyntaxException $e) => throw $e;
}
/**
* Clone the configuration
*
* @return void
*/
public function __clone(): void
{
$this->pointers = new Pointers();
$this->pointers->add(new Pointer('', true));
}
}