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:----d6+tbeFNMBbdU9AiK49WyxfLa6jkqsWXWC/LZ7gxSZuV1rBGULxpYUoWrGSesJkHzrzMdhoc/kJfbbNQv4U6Dg0H4EANTQX6r9ffFlKEhgOFsBw2Q8dj6L06qUsJ/tE6vNccNg49pGCHDbrZVzzPelJjfD91r2gf1956i6cA/7/j7zDcmNGZMcWhBQNDdZpV9egxcDOP3Nyv29rcnKcIzBLSMpfNMlxasIM2+CF8UUVOMUWlqhxsblmN/N5I6lXcTm+NfWVUKBmEo0FI9f3cioaXdrH47cigJ3T4ppjNoRxPduqgzxkpEvaoFaFZUSozTkXWjd0pImSS2oIDhSREO8jbgRprzE6Y0lWPsD2m42hcE885WIbcue765yUcp/Jo9ADmnCpxF+wyEr/FH7LYODgw5YEioZrLhUJPjsAfrCDiAnYYTVzqW0awWT6H0maHdOtc0Y94UrgkRPAkrpVKWi24NTJa9+oulgfV89alIdpbobW3YT6FGs3YLZxWhahKMx4YgpvVhC5l9PCOu1CBg7eMay38Y1jzc7h60w3vOS/F29mvGagd63wlOsMH0Zw9KpXh8vBG6QDR0euFDwvHENwv7SZfNtg6I6CeHFjJk30zN/+oZxn+DQdLu51PFSgfA9tNxDXnnq/aRUW0/AytUCeNdz5HUugLdY+kk4UlaxM=----ATTACHMENT:----MTAzODg4NDY5MTgyMzk5MiAzNzg2MTcxMjk2Njg2Mzk3IDIyNjE5ODA5MDMyNTI0ODM=