@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at upstream/main 46 lines 1.2 kB view raw
1<?php 2 3/** 4 * @phutil-external-symbol class PhpParser\JsonDecoder 5 */ 6final class PhorgePHPASTParseTree extends PhabricatorXHPASTDAO { 7 8 protected $authorPHID; 9 protected $input; 10 protected $tree; 11 protected $error; 12 protected $tokenStream; 13 14 protected function getConfiguration() { 15 return array( 16 self::CONFIG_SERIALIZATION => array( 17 'tokenStream' => self::SERIALIZATION_PHP, 18 'tree' => self::SERIALIZATION_JSON, 19 ), 20 self::CONFIG_BINARY => array( 21 'tokenStream' => true, 22 ), 23 self::CONFIG_COLUMN_SCHEMA => array( 24 'authorPHID' => 'phid?', 25 'error' => 'text?', 26 'input' => 'text', 27 ), 28 ) + parent::getConfiguration(); 29 } 30 31 protected function applyLiskDataSerialization(array &$data, $deserialize) { 32 // applyLiskDataSerialization overwrites $data, so capture the 33 // JSON before it does so. 34 $tree = $data['tree']; 35 36 parent::applyLiskDataSerialization($data, $deserialize); 37 38 if ($deserialize) { 39 $data['tree'] = id(new PhpParser\JsonDecoder())->decode($tree); 40 } 41 } 42 43 public function getTableName() { 44 return 'phpast_parsetree'; 45 } 46}