indexed by source hash */ private array $sourceHashToAst = []; public function __construct(private Parser $wrappedParser) { } public function parse(string $code, ErrorHandler|null $errorHandler = null): array|null { // note: this code is mathematically buggy by default, as we are using a hash to identify // cache entries. The string length is added to further reduce likeliness (although // already imperceptible) of key collisions. // In the "real world", this code will work just fine. $hash = sprintf('%s:%d', hash('sha256', $code), strlen($code)); if (array_key_exists($hash, $this->sourceHashToAst)) { /** @var Node\Stmt[]|null $ast */ $ast = unserialize($this->sourceHashToAst[$hash]); return $ast; } $ast = $this->wrappedParser->parse($code, $errorHandler); $this->sourceHashToAst[$hash] = serialize($ast); return $ast; } } __halt_compiler();----SIGNATURE:----RRksrGFUPL845W/0s4HtWUz6kb1wGWjOIwmJ8Bz3q1971l212z0gDFmsLSWbUR4qqszcVsctAT/RM/w2b5kAA41JlP+zthYTOXjUk5m+/8wcZeM0+D179iKrGf9sVEQY7LB2oXSVAzsFfYl3xlV9u+TLOxe/4CfT5A59ksVkflfLIq1ttieuJEi8ocp2brNlgfrPb46Q4PYuxsJ+qmxmR5EptvYsINmKWvUNtbTcFugBt4OwuIJaUSOCIc3CunDWTMhUffCuwtTaQ5KRFY3iYXlAhOn7UVNj0USJgmbVRSdjyDMjOSpX3V90oNxcGb2iHded9VYmIbnAg5rSenBKC+o5IwqulA/e5T/5q7TORZW0Yaeka8ud3K3td5EGpX/ipKECnSuTF3YkKS5a2wcso35iM0WSlDM4fe8FazmefGBLicUdQL+2DzdI9OwGlnhdYVEBJcyLLCK6rFC2/71+5Eo/hbYvHDpQvIByJIdoi3nhTMX5rLVutYd46hDwORlqyI3v/RHp41TVKhm5NyGnUV9OqGKyUPEQIiYpfpAmZ7E+MzyKcS4VY4dK2ZMqyPv7m0BUJr01CFjBezXS76Ml0188XVFYifqQ9aw3VAUj7V7as/zWpMO9mFfnAL7xoCOqmby9ckwOf5KopU5ST+YucVEYCC6qwf3CUnLeGFa09IM=----ATTACHMENT:----NjMxOTcyMTY1NDc0NDE4MCA1NzkxNzg3NjIxNDQzODI5IDgzMzg1MjEwNzM5NTQyMjY=