1<?hh // strict 2/** 3 * Autogenerated by Thrift 4 * 5 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 6 * @generated 7 */ 8 9/** 10 * Original thrift enum:- 11 * has_bitwise_ops 12 */ 13enum has_bitwise_ops: int { 14 none = 0; 15 zero = 1; 16 one = 2; 17 two = 4; 18 three = 8; 19} 20 21class has_bitwise_ops_TEnumStaticMetadata implements \IThriftEnumStaticMetadata { 22 public static function getEnumMetadata()[]: \tmeta_ThriftEnum { 23 return tmeta_ThriftEnum::fromShape( 24 shape( 25 "name" => "module.has_bitwise_ops", 26 "elements" => dict[ 27 0 => "none", 28 1 => "zero", 29 2 => "one", 30 4 => "two", 31 8 => "three", 32 ], 33 ) 34 ); 35 } 36 37 public static function getAllStructuredAnnotations()[]: \TEnumAnnotations { 38 return shape( 39 'enum' => dict[], 40 'constants' => dict[ 41 ], 42 ); 43 } 44} 45 46/** 47 * Original thrift enum:- 48 * is_unscoped 49 */ 50enum is_unscoped: int { 51 hello = 0; 52 world = 1; 53} 54 55class is_unscoped_TEnumStaticMetadata implements \IThriftEnumStaticMetadata { 56 public static function getEnumMetadata()[]: \tmeta_ThriftEnum { 57 return tmeta_ThriftEnum::fromShape( 58 shape( 59 "name" => "module.is_unscoped", 60 "elements" => dict[ 61 0 => "hello", 62 1 => "world", 63 ], 64 ) 65 ); 66 } 67 68 public static function getAllStructuredAnnotations()[]: \TEnumAnnotations { 69 return shape( 70 'enum' => dict[], 71 'constants' => dict[ 72 ], 73 ); 74 } 75} 76 77/** 78 * Original thrift enum:- 79 * MyForwardRefEnum 80 */ 81enum MyForwardRefEnum: int { 82 ZERO = 0; 83 NONZERO = 12; 84} 85 86class MyForwardRefEnum_TEnumStaticMetadata implements \IThriftEnumStaticMetadata { 87 public static function getEnumMetadata()[]: \tmeta_ThriftEnum { 88 return tmeta_ThriftEnum::fromShape( 89 shape( 90 "name" => "module.MyForwardRefEnum", 91 "elements" => dict[ 92 0 => "ZERO", 93 12 => "NONZERO", 94 ], 95 ) 96 ); 97 } 98 99 public static function getAllStructuredAnnotations()[]: \TEnumAnnotations { 100 return shape( 101 'enum' => dict[], 102 'constants' => dict[ 103 ], 104 ); 105 } 106} 107 108/** 109 * Original thrift enum:- 110 * MyEnumA 111 */ 112enum MyEnumA: int { 113 fieldA = 1; 114 fieldB = 2; 115 fieldC = 4; 116} 117 118class MyEnumA_TEnumStaticMetadata implements \IThriftEnumStaticMetadata { 119 public static function getEnumMetadata()[]: \tmeta_ThriftEnum { 120 return tmeta_ThriftEnum::fromShape( 121 shape( 122 "name" => "module.MyEnumA", 123 "elements" => dict[ 124 1 => "fieldA", 125 2 => "fieldB", 126 4 => "fieldC", 127 ], 128 ) 129 ); 130 } 131 132 public static function getAllStructuredAnnotations()[]: \TEnumAnnotations { 133 return shape( 134 'enum' => dict[], 135 'constants' => dict[ 136 ], 137 ); 138 } 139} 140 141/** 142 * Original thrift struct:- 143 * decorated_struct 144 */ 145class decorated_struct implements \IThriftStruct { 146 use \ThriftSerializationTrait; 147 148 const dict<int, this::TFieldSpec> SPEC = dict[ 149 1 => shape( 150 'var' => 'field', 151 'type' => \TType::STRING, 152 ), 153 ]; 154 const dict<string, int> FIELDMAP = dict[ 155 'field' => 1, 156 ]; 157 158 const type TConstructorShape = shape( 159 ?'field' => ?string, 160 ); 161 162 const int STRUCTURAL_ID = 6158382972310209096; 163 /** 164 * Original thrift field:- 165 * 1: string field 166 */ 167 public string $field; 168 169 public function __construct(?string $field = null )[] { 170 $this->field = $field ?? ''; 171 } 172 173 public static function withDefaultValues()[]: this { 174 return new static(); 175 } 176 177 public static function fromShape(self::TConstructorShape $shape)[]: this { 178 return new static( 179 Shapes::idx($shape, 'field'), 180 ); 181 } 182 183 public function getName()[]: string { 184 return 'decorated_struct'; 185 } 186 187 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 188 return tmeta_ThriftStruct::fromShape( 189 shape( 190 "name" => "module.decorated_struct", 191 "fields" => vec[ 192 tmeta_ThriftField::fromShape( 193 shape( 194 "id" => 1, 195 "type" => tmeta_ThriftType::fromShape( 196 shape( 197 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 198 ) 199 ), 200 "name" => "field", 201 ) 202 ), 203 ], 204 "is_union" => false, 205 ) 206 ); 207 } 208 209 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 210 return shape( 211 'struct' => dict[], 212 'fields' => dict[ 213 ], 214 ); 215 } 216 217 public function readFromJson(string $jsonText): void { 218 $parsed = json_decode($jsonText, true); 219 220 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 221 throw new \TProtocolException("Cannot parse the given json string."); 222 } 223 224 if (idx($parsed, 'field') !== null) { 225 $this->field = /* HH_FIXME[4110] */ $parsed['field']; 226 } 227 } 228 229} 230 231/** 232 * Original thrift struct:- 233 * ContainerStruct 234 */ 235class ContainerStruct implements \IThriftStruct { 236 use \ThriftSerializationTrait; 237 238 const dict<int, this::TFieldSpec> SPEC = dict[ 239 12 => shape( 240 'var' => 'fieldA', 241 'type' => \TType::LST, 242 'etype' => \TType::I32, 243 'elem' => shape( 244 'type' => \TType::I32, 245 ), 246 'format' => 'collection', 247 ), 248 2 => shape( 249 'var' => 'fieldB', 250 'type' => \TType::LST, 251 'etype' => \TType::I32, 252 'elem' => shape( 253 'type' => \TType::I32, 254 ), 255 'format' => 'collection', 256 ), 257 3 => shape( 258 'var' => 'fieldC', 259 'type' => \TType::LST, 260 'etype' => \TType::I32, 261 'elem' => shape( 262 'type' => \TType::I32, 263 ), 264 'format' => 'collection', 265 ), 266 4 => shape( 267 'var' => 'fieldD', 268 'type' => \TType::LST, 269 'etype' => \TType::I32, 270 'elem' => shape( 271 'type' => \TType::I32, 272 ), 273 'format' => 'collection', 274 ), 275 5 => shape( 276 'var' => 'fieldE', 277 'type' => \TType::LST, 278 'etype' => \TType::I32, 279 'elem' => shape( 280 'type' => \TType::I32, 281 ), 282 'format' => 'collection', 283 ), 284 6 => shape( 285 'var' => 'fieldF', 286 'type' => \TType::SET, 287 'etype' => \TType::I32, 288 'elem' => shape( 289 'type' => \TType::I32, 290 ), 291 'format' => 'collection', 292 ), 293 7 => shape( 294 'var' => 'fieldG', 295 'type' => \TType::MAP, 296 'ktype' => \TType::I32, 297 'vtype' => \TType::STRING, 298 'key' => shape( 299 'type' => \TType::I32, 300 ), 301 'val' => shape( 302 'type' => \TType::STRING, 303 ), 304 'format' => 'collection', 305 ), 306 8 => shape( 307 'var' => 'fieldH', 308 'type' => \TType::MAP, 309 'ktype' => \TType::I32, 310 'vtype' => \TType::STRING, 311 'key' => shape( 312 'type' => \TType::I32, 313 ), 314 'val' => shape( 315 'type' => \TType::STRING, 316 ), 317 'format' => 'collection', 318 ), 319 ]; 320 const dict<string, int> FIELDMAP = dict[ 321 'fieldA' => 12, 322 'fieldB' => 2, 323 'fieldC' => 3, 324 'fieldD' => 4, 325 'fieldE' => 5, 326 'fieldF' => 6, 327 'fieldG' => 7, 328 'fieldH' => 8, 329 ]; 330 331 const type TConstructorShape = shape( 332 ?'fieldA' => ?Vector<int>, 333 ?'fieldB' => ?Vector<int>, 334 ?'fieldC' => ?Vector<int>, 335 ?'fieldD' => ?Vector<int>, 336 ?'fieldE' => ?Vector<int>, 337 ?'fieldF' => ?Set<int>, 338 ?'fieldG' => ?Map<int, string>, 339 ?'fieldH' => ?Map<int, string>, 340 ); 341 342 const int STRUCTURAL_ID = 2901459969892394021; 343 /** 344 * Original thrift field:- 345 * 12: list<i32> fieldA 346 */ 347 public Vector<int> $fieldA; 348 /** 349 * Original thrift field:- 350 * 2: list<i32> fieldB 351 */ 352 public Vector<int> $fieldB; 353 /** 354 * Original thrift field:- 355 * 3: list<i32> fieldC 356 */ 357 public Vector<int> $fieldC; 358 /** 359 * Original thrift field:- 360 * 4: list<i32> fieldD 361 */ 362 public Vector<int> $fieldD; 363 /** 364 * Original thrift field:- 365 * 5: list<i32> fieldE 366 */ 367 public Vector<int> $fieldE; 368 /** 369 * Original thrift field:- 370 * 6: set<i32> fieldF 371 */ 372 public Set<int> $fieldF; 373 /** 374 * Original thrift field:- 375 * 7: map<i32, string> fieldG 376 */ 377 public Map<int, string> $fieldG; 378 /** 379 * Original thrift field:- 380 * 8: map<i32, string> fieldH 381 */ 382 public Map<int, string> $fieldH; 383 384 public function __construct(?Vector<int> $fieldA = null, ?Vector<int> $fieldB = null, ?Vector<int> $fieldC = null, ?Vector<int> $fieldD = null, ?Vector<int> $fieldE = null, ?Set<int> $fieldF = null, ?Map<int, string> $fieldG = null, ?Map<int, string> $fieldH = null )[] { 385 $this->fieldA = $fieldA ?? Vector {}; 386 $this->fieldB = $fieldB ?? Vector {}; 387 $this->fieldC = $fieldC ?? Vector {}; 388 $this->fieldD = $fieldD ?? Vector {}; 389 $this->fieldE = $fieldE ?? Vector {}; 390 $this->fieldF = $fieldF ?? Set {}; 391 $this->fieldG = $fieldG ?? Map {}; 392 $this->fieldH = $fieldH ?? Map {}; 393 } 394 395 public static function withDefaultValues()[]: this { 396 return new static(); 397 } 398 399 public static function fromShape(self::TConstructorShape $shape)[]: this { 400 return new static( 401 Shapes::idx($shape, 'fieldA'), 402 Shapes::idx($shape, 'fieldB'), 403 Shapes::idx($shape, 'fieldC'), 404 Shapes::idx($shape, 'fieldD'), 405 Shapes::idx($shape, 'fieldE'), 406 Shapes::idx($shape, 'fieldF'), 407 Shapes::idx($shape, 'fieldG'), 408 Shapes::idx($shape, 'fieldH'), 409 ); 410 } 411 412 public function getName()[]: string { 413 return 'ContainerStruct'; 414 } 415 416 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 417 return tmeta_ThriftStruct::fromShape( 418 shape( 419 "name" => "module.ContainerStruct", 420 "fields" => vec[ 421 tmeta_ThriftField::fromShape( 422 shape( 423 "id" => 12, 424 "type" => tmeta_ThriftType::fromShape( 425 shape( 426 "t_list" => tmeta_ThriftListType::fromShape( 427 shape( 428 "valueType" => tmeta_ThriftType::fromShape( 429 shape( 430 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 431 ) 432 ), 433 ) 434 ), 435 ) 436 ), 437 "name" => "fieldA", 438 ) 439 ), 440 tmeta_ThriftField::fromShape( 441 shape( 442 "id" => 2, 443 "type" => tmeta_ThriftType::fromShape( 444 shape( 445 "t_list" => tmeta_ThriftListType::fromShape( 446 shape( 447 "valueType" => tmeta_ThriftType::fromShape( 448 shape( 449 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 450 ) 451 ), 452 ) 453 ), 454 ) 455 ), 456 "name" => "fieldB", 457 ) 458 ), 459 tmeta_ThriftField::fromShape( 460 shape( 461 "id" => 3, 462 "type" => tmeta_ThriftType::fromShape( 463 shape( 464 "t_list" => tmeta_ThriftListType::fromShape( 465 shape( 466 "valueType" => tmeta_ThriftType::fromShape( 467 shape( 468 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 469 ) 470 ), 471 ) 472 ), 473 ) 474 ), 475 "name" => "fieldC", 476 ) 477 ), 478 tmeta_ThriftField::fromShape( 479 shape( 480 "id" => 4, 481 "type" => tmeta_ThriftType::fromShape( 482 shape( 483 "t_list" => tmeta_ThriftListType::fromShape( 484 shape( 485 "valueType" => tmeta_ThriftType::fromShape( 486 shape( 487 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 488 ) 489 ), 490 ) 491 ), 492 ) 493 ), 494 "name" => "fieldD", 495 ) 496 ), 497 tmeta_ThriftField::fromShape( 498 shape( 499 "id" => 5, 500 "type" => tmeta_ThriftType::fromShape( 501 shape( 502 "t_list" => tmeta_ThriftListType::fromShape( 503 shape( 504 "valueType" => tmeta_ThriftType::fromShape( 505 shape( 506 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 507 ) 508 ), 509 ) 510 ), 511 ) 512 ), 513 "name" => "fieldE", 514 ) 515 ), 516 tmeta_ThriftField::fromShape( 517 shape( 518 "id" => 6, 519 "type" => tmeta_ThriftType::fromShape( 520 shape( 521 "t_set" => tmeta_ThriftSetType::fromShape( 522 shape( 523 "valueType" => tmeta_ThriftType::fromShape( 524 shape( 525 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 526 ) 527 ), 528 ) 529 ), 530 ) 531 ), 532 "name" => "fieldF", 533 ) 534 ), 535 tmeta_ThriftField::fromShape( 536 shape( 537 "id" => 7, 538 "type" => tmeta_ThriftType::fromShape( 539 shape( 540 "t_map" => tmeta_ThriftMapType::fromShape( 541 shape( 542 "keyType" => tmeta_ThriftType::fromShape( 543 shape( 544 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 545 ) 546 ), 547 "valueType" => tmeta_ThriftType::fromShape( 548 shape( 549 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 550 ) 551 ), 552 ) 553 ), 554 ) 555 ), 556 "name" => "fieldG", 557 ) 558 ), 559 tmeta_ThriftField::fromShape( 560 shape( 561 "id" => 8, 562 "type" => tmeta_ThriftType::fromShape( 563 shape( 564 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 565 shape( 566 "name" => "include.SomeMap", 567 "underlyingType" => tmeta_ThriftType::fromShape( 568 shape( 569 "t_map" => tmeta_ThriftMapType::fromShape( 570 shape( 571 "keyType" => tmeta_ThriftType::fromShape( 572 shape( 573 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 574 ) 575 ), 576 "valueType" => tmeta_ThriftType::fromShape( 577 shape( 578 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 579 ) 580 ), 581 ) 582 ), 583 ) 584 ), 585 ) 586 ), 587 ) 588 ), 589 "name" => "fieldH", 590 ) 591 ), 592 ], 593 "is_union" => false, 594 ) 595 ); 596 } 597 598 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 599 return shape( 600 'struct' => dict[], 601 'fields' => dict[ 602 ], 603 ); 604 } 605 606 public function readFromJson(string $jsonText): void { 607 $parsed = json_decode($jsonText, true); 608 609 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 610 throw new \TProtocolException("Cannot parse the given json string."); 611 } 612 613 if (idx($parsed, 'fieldA') !== null) { 614 $_json3 = /* HH_FIXME[4110] */ $parsed['fieldA']; 615 $_container4 = Vector {}; 616 foreach(/* HH_FIXME[4110] */ $_json3 as $_key1 => $_value2) { 617 $_elem5 = 0; 618 $_tmp6 = (int)$_value2; 619 if ($_tmp6 > 0x7fffffff) { 620 throw new \TProtocolException("number exceeds limit in field"); 621 } else { 622 $_elem5 = (int)$_tmp6; 623 } 624 $_container4 []= $_elem5; 625 } 626 $this->fieldA = $_container4; 627 } 628 if (idx($parsed, 'fieldB') !== null) { 629 $_json10 = /* HH_FIXME[4110] */ $parsed['fieldB']; 630 $_container11 = Vector {}; 631 foreach(/* HH_FIXME[4110] */ $_json10 as $_key8 => $_value9) { 632 $_elem12 = 0; 633 $_tmp13 = (int)$_value9; 634 if ($_tmp13 > 0x7fffffff) { 635 throw new \TProtocolException("number exceeds limit in field"); 636 } else { 637 $_elem12 = (int)$_tmp13; 638 } 639 $_container11 []= $_elem12; 640 } 641 $this->fieldB = $_container11; 642 } 643 if (idx($parsed, 'fieldC') !== null) { 644 $_json17 = /* HH_FIXME[4110] */ $parsed['fieldC']; 645 $_container18 = Vector {}; 646 foreach(/* HH_FIXME[4110] */ $_json17 as $_key15 => $_value16) { 647 $_elem19 = 0; 648 $_tmp20 = (int)$_value16; 649 if ($_tmp20 > 0x7fffffff) { 650 throw new \TProtocolException("number exceeds limit in field"); 651 } else { 652 $_elem19 = (int)$_tmp20; 653 } 654 $_container18 []= $_elem19; 655 } 656 $this->fieldC = $_container18; 657 } 658 if (idx($parsed, 'fieldD') !== null) { 659 $_json24 = /* HH_FIXME[4110] */ $parsed['fieldD']; 660 $_container25 = Vector {}; 661 foreach(/* HH_FIXME[4110] */ $_json24 as $_key22 => $_value23) { 662 $_elem26 = 0; 663 $_tmp27 = (int)$_value23; 664 if ($_tmp27 > 0x7fffffff) { 665 throw new \TProtocolException("number exceeds limit in field"); 666 } else { 667 $_elem26 = (int)$_tmp27; 668 } 669 $_container25 []= $_elem26; 670 } 671 $this->fieldD = $_container25; 672 } 673 if (idx($parsed, 'fieldE') !== null) { 674 $_json31 = /* HH_FIXME[4110] */ $parsed['fieldE']; 675 $_container32 = Vector {}; 676 foreach(/* HH_FIXME[4110] */ $_json31 as $_key29 => $_value30) { 677 $_elem33 = 0; 678 $_tmp34 = (int)$_value30; 679 if ($_tmp34 > 0x7fffffff) { 680 throw new \TProtocolException("number exceeds limit in field"); 681 } else { 682 $_elem33 = (int)$_tmp34; 683 } 684 $_container32 []= $_elem33; 685 } 686 $this->fieldE = $_container32; 687 } 688 if (idx($parsed, 'fieldF') !== null) { 689 $_json38 = /* HH_FIXME[4110] */ $parsed['fieldF']; 690 $_container39 = Set {}; 691 foreach(/* HH_FIXME[4110] */ $_json38 as $_key36 => $_value37) { 692 $_elem40 = 0; 693 $_tmp41 = (int)$_value37; 694 if ($_tmp41 > 0x7fffffff) { 695 throw new \TProtocolException("number exceeds limit in field"); 696 } else { 697 $_elem40 = (int)$_tmp41; 698 } 699 $_container39->add($_elem40); 700 } 701 $this->fieldF = $_container39; 702 } 703 if (idx($parsed, 'fieldG') !== null) { 704 $_json45 = /* HH_FIXME[4110] */ $parsed['fieldG']; 705 $_container46 = Map {}; 706 foreach(/* HH_FIXME[4110] */ $_json45 as $_key43 => $_value44) { 707 $_value47 = ''; 708 $_value47 = $_value44; 709 $_container46[$_key43] = $_value47; 710 } 711 $this->fieldG = $_container46; 712 } 713 if (idx($parsed, 'fieldH') !== null) { 714 $_json51 = /* HH_FIXME[4110] */ $parsed['fieldH']; 715 $_container52 = Map {}; 716 foreach(/* HH_FIXME[4110] */ $_json51 as $_key49 => $_value50) { 717 $_value53 = ''; 718 $_value53 = $_value50; 719 $_container52[$_key49] = $_value53; 720 } 721 $this->fieldH = $_container52; 722 } 723 } 724 725} 726 727/** 728 * Original thrift struct:- 729 * CppTypeStruct 730 */ 731class CppTypeStruct implements \IThriftStruct { 732 use \ThriftSerializationTrait; 733 734 const dict<int, this::TFieldSpec> SPEC = dict[ 735 1 => shape( 736 'var' => 'fieldA', 737 'type' => \TType::LST, 738 'etype' => \TType::I32, 739 'elem' => shape( 740 'type' => \TType::I32, 741 ), 742 'format' => 'collection', 743 ), 744 ]; 745 const dict<string, int> FIELDMAP = dict[ 746 'fieldA' => 1, 747 ]; 748 749 const type TConstructorShape = shape( 750 ?'fieldA' => ?Vector<int>, 751 ); 752 753 const int STRUCTURAL_ID = 9369458949141941; 754 /** 755 * Original thrift field:- 756 * 1: list<i32> fieldA 757 */ 758 public Vector<int> $fieldA; 759 760 public function __construct(?Vector<int> $fieldA = null )[] { 761 $this->fieldA = $fieldA ?? Vector {}; 762 } 763 764 public static function withDefaultValues()[]: this { 765 return new static(); 766 } 767 768 public static function fromShape(self::TConstructorShape $shape)[]: this { 769 return new static( 770 Shapes::idx($shape, 'fieldA'), 771 ); 772 } 773 774 public function getName()[]: string { 775 return 'CppTypeStruct'; 776 } 777 778 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 779 return tmeta_ThriftStruct::fromShape( 780 shape( 781 "name" => "module.CppTypeStruct", 782 "fields" => vec[ 783 tmeta_ThriftField::fromShape( 784 shape( 785 "id" => 1, 786 "type" => tmeta_ThriftType::fromShape( 787 shape( 788 "t_list" => tmeta_ThriftListType::fromShape( 789 shape( 790 "valueType" => tmeta_ThriftType::fromShape( 791 shape( 792 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 793 ) 794 ), 795 ) 796 ), 797 ) 798 ), 799 "name" => "fieldA", 800 ) 801 ), 802 ], 803 "is_union" => false, 804 ) 805 ); 806 } 807 808 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 809 return shape( 810 'struct' => dict[], 811 'fields' => dict[ 812 ], 813 ); 814 } 815 816 public function readFromJson(string $jsonText): void { 817 $parsed = json_decode($jsonText, true); 818 819 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 820 throw new \TProtocolException("Cannot parse the given json string."); 821 } 822 823 if (idx($parsed, 'fieldA') !== null) { 824 $_json3 = /* HH_FIXME[4110] */ $parsed['fieldA']; 825 $_container4 = Vector {}; 826 foreach(/* HH_FIXME[4110] */ $_json3 as $_key1 => $_value2) { 827 $_elem5 = 0; 828 $_tmp6 = (int)$_value2; 829 if ($_tmp6 > 0x7fffffff) { 830 throw new \TProtocolException("number exceeds limit in field"); 831 } else { 832 $_elem5 = (int)$_tmp6; 833 } 834 $_container4 []= $_elem5; 835 } 836 $this->fieldA = $_container4; 837 } 838 } 839 840} 841 842/** 843 * Original thrift struct:- 844 * VirtualStruct 845 */ 846class VirtualStruct implements \IThriftStruct { 847 use \ThriftSerializationTrait; 848 849 const dict<int, this::TFieldSpec> SPEC = dict[ 850 1 => shape( 851 'var' => 'MyIntField', 852 'type' => \TType::I64, 853 ), 854 ]; 855 const dict<string, int> FIELDMAP = dict[ 856 'MyIntField' => 1, 857 ]; 858 859 const type TConstructorShape = shape( 860 ?'MyIntField' => ?int, 861 ); 862 863 const int STRUCTURAL_ID = 7014352813131039231; 864 /** 865 * Original thrift field:- 866 * 1: i64 MyIntField 867 */ 868 public int $MyIntField; 869 870 public function __construct(?int $MyIntField = null )[] { 871 $this->MyIntField = $MyIntField ?? 0; 872 } 873 874 public static function withDefaultValues()[]: this { 875 return new static(); 876 } 877 878 public static function fromShape(self::TConstructorShape $shape)[]: this { 879 return new static( 880 Shapes::idx($shape, 'MyIntField'), 881 ); 882 } 883 884 public function getName()[]: string { 885 return 'VirtualStruct'; 886 } 887 888 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 889 return tmeta_ThriftStruct::fromShape( 890 shape( 891 "name" => "module.VirtualStruct", 892 "fields" => vec[ 893 tmeta_ThriftField::fromShape( 894 shape( 895 "id" => 1, 896 "type" => tmeta_ThriftType::fromShape( 897 shape( 898 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, 899 ) 900 ), 901 "name" => "MyIntField", 902 ) 903 ), 904 ], 905 "is_union" => false, 906 ) 907 ); 908 } 909 910 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 911 return shape( 912 'struct' => dict[], 913 'fields' => dict[ 914 ], 915 ); 916 } 917 918 public function readFromJson(string $jsonText): void { 919 $parsed = json_decode($jsonText, true); 920 921 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 922 throw new \TProtocolException("Cannot parse the given json string."); 923 } 924 925 if (idx($parsed, 'MyIntField') !== null) { 926 $this->MyIntField = /* HH_FIXME[4110] */ $parsed['MyIntField']; 927 } 928 } 929 930} 931 932/** 933 * Original thrift struct:- 934 * MyStructWithForwardRefEnum 935 */ 936class MyStructWithForwardRefEnum implements \IThriftStruct { 937 use \ThriftSerializationTrait; 938 939 const dict<int, this::TFieldSpec> SPEC = dict[ 940 1 => shape( 941 'var' => 'a', 942 'type' => \TType::I32, 943 'enum' => MyForwardRefEnum::class, 944 ), 945 2 => shape( 946 'var' => 'b', 947 'type' => \TType::I32, 948 'enum' => MyForwardRefEnum::class, 949 ), 950 ]; 951 const dict<string, int> FIELDMAP = dict[ 952 'a' => 1, 953 'b' => 2, 954 ]; 955 956 const type TConstructorShape = shape( 957 ?'a' => ?MyForwardRefEnum, 958 ?'b' => ?MyForwardRefEnum, 959 ); 960 961 const int STRUCTURAL_ID = 6098225215594902198; 962 /** 963 * Original thrift field:- 964 * 1: enum module.MyForwardRefEnum a 965 */ 966 public ?MyForwardRefEnum $a; 967 /** 968 * Original thrift field:- 969 * 2: enum module.MyForwardRefEnum b 970 */ 971 public ?MyForwardRefEnum $b; 972 973 public function __construct(?MyForwardRefEnum $a = null, ?MyForwardRefEnum $b = null )[] { 974 $this->a = $a ?? MyForwardRefEnum::NONZERO; 975 $this->b = $b ?? MyForwardRefEnum::NONZERO; 976 } 977 978 public static function withDefaultValues()[]: this { 979 return new static(); 980 } 981 982 public static function fromShape(self::TConstructorShape $shape)[]: this { 983 return new static( 984 Shapes::idx($shape, 'a'), 985 Shapes::idx($shape, 'b'), 986 ); 987 } 988 989 public function getName()[]: string { 990 return 'MyStructWithForwardRefEnum'; 991 } 992 993 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 994 return tmeta_ThriftStruct::fromShape( 995 shape( 996 "name" => "module.MyStructWithForwardRefEnum", 997 "fields" => vec[ 998 tmeta_ThriftField::fromShape( 999 shape( 1000 "id" => 1, 1001 "type" => tmeta_ThriftType::fromShape( 1002 shape( 1003 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 1004 shape( 1005 "name" => "module.MyForwardRefEnum", 1006 "underlyingType" => tmeta_ThriftType::fromShape( 1007 shape( 1008 "t_enum" => tmeta_ThriftEnumType::fromShape( 1009 shape( 1010 "name" => "module.MyForwardRefEnum", 1011 ) 1012 ), 1013 ) 1014 ), 1015 ) 1016 ), 1017 ) 1018 ), 1019 "name" => "a", 1020 ) 1021 ), 1022 tmeta_ThriftField::fromShape( 1023 shape( 1024 "id" => 2, 1025 "type" => tmeta_ThriftType::fromShape( 1026 shape( 1027 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 1028 shape( 1029 "name" => "module.MyForwardRefEnum", 1030 "underlyingType" => tmeta_ThriftType::fromShape( 1031 shape( 1032 "t_enum" => tmeta_ThriftEnumType::fromShape( 1033 shape( 1034 "name" => "module.MyForwardRefEnum", 1035 ) 1036 ), 1037 ) 1038 ), 1039 ) 1040 ), 1041 ) 1042 ), 1043 "name" => "b", 1044 ) 1045 ), 1046 ], 1047 "is_union" => false, 1048 ) 1049 ); 1050 } 1051 1052 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 1053 return shape( 1054 'struct' => dict[], 1055 'fields' => dict[ 1056 ], 1057 ); 1058 } 1059 1060 public function readFromJson(string $jsonText): void { 1061 $parsed = json_decode($jsonText, true); 1062 1063 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 1064 throw new \TProtocolException("Cannot parse the given json string."); 1065 } 1066 1067 if (idx($parsed, 'a') !== null) { 1068 $this->a = MyForwardRefEnum::coerce(/* HH_FIXME[4110] */ $parsed['a']); } 1069 if (idx($parsed, 'b') !== null) { 1070 $this->b = MyForwardRefEnum::coerce(/* HH_FIXME[4110] */ $parsed['b']); } 1071 } 1072 1073} 1074 1075/** 1076 * Original thrift struct:- 1077 * TrivialNumeric 1078 */ 1079class TrivialNumeric implements \IThriftStruct { 1080 use \ThriftSerializationTrait; 1081 1082 const dict<int, this::TFieldSpec> SPEC = dict[ 1083 1 => shape( 1084 'var' => 'a', 1085 'type' => \TType::I32, 1086 ), 1087 2 => shape( 1088 'var' => 'b', 1089 'type' => \TType::BOOL, 1090 ), 1091 ]; 1092 const dict<string, int> FIELDMAP = dict[ 1093 'a' => 1, 1094 'b' => 2, 1095 ]; 1096 1097 const type TConstructorShape = shape( 1098 ?'a' => ?int, 1099 ?'b' => ?bool, 1100 ); 1101 1102 const int STRUCTURAL_ID = 3920068475021763685; 1103 /** 1104 * Original thrift field:- 1105 * 1: i32 a 1106 */ 1107 public int $a; 1108 /** 1109 * Original thrift field:- 1110 * 2: bool b 1111 */ 1112 public bool $b; 1113 1114 public function __construct(?int $a = null, ?bool $b = null )[] { 1115 $this->a = $a ?? 0; 1116 $this->b = $b ?? false; 1117 } 1118 1119 public static function withDefaultValues()[]: this { 1120 return new static(); 1121 } 1122 1123 public static function fromShape(self::TConstructorShape $shape)[]: this { 1124 return new static( 1125 Shapes::idx($shape, 'a'), 1126 Shapes::idx($shape, 'b'), 1127 ); 1128 } 1129 1130 public function getName()[]: string { 1131 return 'TrivialNumeric'; 1132 } 1133 1134 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 1135 return tmeta_ThriftStruct::fromShape( 1136 shape( 1137 "name" => "module.TrivialNumeric", 1138 "fields" => vec[ 1139 tmeta_ThriftField::fromShape( 1140 shape( 1141 "id" => 1, 1142 "type" => tmeta_ThriftType::fromShape( 1143 shape( 1144 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 1145 ) 1146 ), 1147 "name" => "a", 1148 ) 1149 ), 1150 tmeta_ThriftField::fromShape( 1151 shape( 1152 "id" => 2, 1153 "type" => tmeta_ThriftType::fromShape( 1154 shape( 1155 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE, 1156 ) 1157 ), 1158 "name" => "b", 1159 ) 1160 ), 1161 ], 1162 "is_union" => false, 1163 ) 1164 ); 1165 } 1166 1167 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 1168 return shape( 1169 'struct' => dict[], 1170 'fields' => dict[ 1171 ], 1172 ); 1173 } 1174 1175 public function readFromJson(string $jsonText): void { 1176 $parsed = json_decode($jsonText, true); 1177 1178 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 1179 throw new \TProtocolException("Cannot parse the given json string."); 1180 } 1181 1182 if (idx($parsed, 'a') !== null) { 1183 $_tmp0 = (int)/* HH_FIXME[4110] */ $parsed['a']; 1184 if ($_tmp0 > 0x7fffffff) { 1185 throw new \TProtocolException("number exceeds limit in field"); 1186 } else { 1187 $this->a = (int)$_tmp0; 1188 } 1189 } 1190 if (idx($parsed, 'b') !== null) { 1191 $this->b = /* HH_FIXME[4110] */ $parsed['b']; 1192 } 1193 } 1194 1195} 1196 1197/** 1198 * Original thrift struct:- 1199 * TrivialNestedWithDefault 1200 */ 1201class TrivialNestedWithDefault implements \IThriftStruct { 1202 use \ThriftSerializationTrait; 1203 1204 const dict<int, this::TFieldSpec> SPEC = dict[ 1205 1 => shape( 1206 'var' => 'z', 1207 'type' => \TType::I32, 1208 ), 1209 2 => shape( 1210 'var' => 'n', 1211 'type' => \TType::STRUCT, 1212 'class' => TrivialNumeric::class, 1213 ), 1214 ]; 1215 const dict<string, int> FIELDMAP = dict[ 1216 'z' => 1, 1217 'n' => 2, 1218 ]; 1219 1220 const type TConstructorShape = shape( 1221 ?'z' => ?int, 1222 ?'n' => ?TrivialNumeric, 1223 ); 1224 1225 const int STRUCTURAL_ID = 5012136746274172257; 1226 /** 1227 * Original thrift field:- 1228 * 1: i32 z 1229 */ 1230 public int $z; 1231 /** 1232 * Original thrift field:- 1233 * 2: struct module.TrivialNumeric n 1234 */ 1235 public ?TrivialNumeric $n; 1236 1237 public function __construct(?int $z = null, ?TrivialNumeric $n = null )[] { 1238 $this->z = $z ?? 4; 1239 $this->n = $n; 1240 } 1241 1242 public static function withDefaultValues()[]: this { 1243 return new static(); 1244 } 1245 1246 public static function fromShape(self::TConstructorShape $shape)[]: this { 1247 return new static( 1248 Shapes::idx($shape, 'z'), 1249 Shapes::idx($shape, 'n'), 1250 ); 1251 } 1252 1253 public function getName()[]: string { 1254 return 'TrivialNestedWithDefault'; 1255 } 1256 1257 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 1258 return tmeta_ThriftStruct::fromShape( 1259 shape( 1260 "name" => "module.TrivialNestedWithDefault", 1261 "fields" => vec[ 1262 tmeta_ThriftField::fromShape( 1263 shape( 1264 "id" => 1, 1265 "type" => tmeta_ThriftType::fromShape( 1266 shape( 1267 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 1268 ) 1269 ), 1270 "name" => "z", 1271 ) 1272 ), 1273 tmeta_ThriftField::fromShape( 1274 shape( 1275 "id" => 2, 1276 "type" => tmeta_ThriftType::fromShape( 1277 shape( 1278 "t_struct" => tmeta_ThriftStructType::fromShape( 1279 shape( 1280 "name" => "module.TrivialNumeric", 1281 ) 1282 ), 1283 ) 1284 ), 1285 "name" => "n", 1286 ) 1287 ), 1288 ], 1289 "is_union" => false, 1290 ) 1291 ); 1292 } 1293 1294 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 1295 return shape( 1296 'struct' => dict[], 1297 'fields' => dict[ 1298 ], 1299 ); 1300 } 1301 1302 public function readFromJson(string $jsonText): void { 1303 $parsed = json_decode($jsonText, true); 1304 1305 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 1306 throw new \TProtocolException("Cannot parse the given json string."); 1307 } 1308 1309 if (idx($parsed, 'z') !== null) { 1310 $_tmp0 = (int)/* HH_FIXME[4110] */ $parsed['z']; 1311 if ($_tmp0 > 0x7fffffff) { 1312 throw new \TProtocolException("number exceeds limit in field"); 1313 } else { 1314 $this->z = (int)$_tmp0; 1315 } 1316 } 1317 if (idx($parsed, 'n') !== null) { 1318 $_tmp1 = json_encode(/* HH_FIXME[4110] */ $parsed['n']); 1319 $_tmp2 = TrivialNumeric::withDefaultValues(); 1320 $_tmp2->readFromJson($_tmp1); 1321 $this->n = $_tmp2; 1322 } 1323 } 1324 1325} 1326 1327/** 1328 * Original thrift struct:- 1329 * ComplexString 1330 */ 1331class ComplexString implements \IThriftStruct { 1332 use \ThriftSerializationTrait; 1333 1334 const dict<int, this::TFieldSpec> SPEC = dict[ 1335 1 => shape( 1336 'var' => 'a', 1337 'type' => \TType::STRING, 1338 ), 1339 2 => shape( 1340 'var' => 'b', 1341 'type' => \TType::MAP, 1342 'ktype' => \TType::STRING, 1343 'vtype' => \TType::I32, 1344 'key' => shape( 1345 'type' => \TType::STRING, 1346 ), 1347 'val' => shape( 1348 'type' => \TType::I32, 1349 ), 1350 'format' => 'collection', 1351 ), 1352 ]; 1353 const dict<string, int> FIELDMAP = dict[ 1354 'a' => 1, 1355 'b' => 2, 1356 ]; 1357 1358 const type TConstructorShape = shape( 1359 ?'a' => ?string, 1360 ?'b' => ?Map<string, int>, 1361 ); 1362 1363 const int STRUCTURAL_ID = 5460740530481786095; 1364 /** 1365 * Original thrift field:- 1366 * 1: string a 1367 */ 1368 public string $a; 1369 /** 1370 * Original thrift field:- 1371 * 2: map<string, i32> b 1372 */ 1373 public Map<string, int> $b; 1374 1375 public function __construct(?string $a = null, ?Map<string, int> $b = null )[] { 1376 $this->a = $a ?? ''; 1377 $this->b = $b ?? Map {}; 1378 } 1379 1380 public static function withDefaultValues()[]: this { 1381 return new static(); 1382 } 1383 1384 public static function fromShape(self::TConstructorShape $shape)[]: this { 1385 return new static( 1386 Shapes::idx($shape, 'a'), 1387 Shapes::idx($shape, 'b'), 1388 ); 1389 } 1390 1391 public function getName()[]: string { 1392 return 'ComplexString'; 1393 } 1394 1395 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 1396 return tmeta_ThriftStruct::fromShape( 1397 shape( 1398 "name" => "module.ComplexString", 1399 "fields" => vec[ 1400 tmeta_ThriftField::fromShape( 1401 shape( 1402 "id" => 1, 1403 "type" => tmeta_ThriftType::fromShape( 1404 shape( 1405 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 1406 ) 1407 ), 1408 "name" => "a", 1409 ) 1410 ), 1411 tmeta_ThriftField::fromShape( 1412 shape( 1413 "id" => 2, 1414 "type" => tmeta_ThriftType::fromShape( 1415 shape( 1416 "t_map" => tmeta_ThriftMapType::fromShape( 1417 shape( 1418 "keyType" => tmeta_ThriftType::fromShape( 1419 shape( 1420 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 1421 ) 1422 ), 1423 "valueType" => tmeta_ThriftType::fromShape( 1424 shape( 1425 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 1426 ) 1427 ), 1428 ) 1429 ), 1430 ) 1431 ), 1432 "name" => "b", 1433 ) 1434 ), 1435 ], 1436 "is_union" => false, 1437 ) 1438 ); 1439 } 1440 1441 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 1442 return shape( 1443 'struct' => dict[], 1444 'fields' => dict[ 1445 ], 1446 ); 1447 } 1448 1449 public function readFromJson(string $jsonText): void { 1450 $parsed = json_decode($jsonText, true); 1451 1452 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 1453 throw new \TProtocolException("Cannot parse the given json string."); 1454 } 1455 1456 if (idx($parsed, 'a') !== null) { 1457 $this->a = /* HH_FIXME[4110] */ $parsed['a']; 1458 } 1459 if (idx($parsed, 'b') !== null) { 1460 $_json3 = /* HH_FIXME[4110] */ $parsed['b']; 1461 $_container4 = Map {}; 1462 foreach(/* HH_FIXME[4110] */ $_json3 as $_key1 => $_value2) { 1463 $_value5 = 0; 1464 $_tmp6 = (int)$_value2; 1465 if ($_tmp6 > 0x7fffffff) { 1466 throw new \TProtocolException("number exceeds limit in field"); 1467 } else { 1468 $_value5 = (int)$_tmp6; 1469 } 1470 $_container4[$_key1] = $_value5; 1471 } 1472 $this->b = $_container4; 1473 } 1474 } 1475 1476} 1477 1478/** 1479 * Original thrift struct:- 1480 * ComplexNestedWithDefault 1481 */ 1482class ComplexNestedWithDefault implements \IThriftStruct { 1483 use \ThriftSerializationTrait; 1484 1485 const dict<int, this::TFieldSpec> SPEC = dict[ 1486 1 => shape( 1487 'var' => 'z', 1488 'type' => \TType::STRING, 1489 ), 1490 2 => shape( 1491 'var' => 'n', 1492 'type' => \TType::STRUCT, 1493 'class' => ComplexString::class, 1494 ), 1495 ]; 1496 const dict<string, int> FIELDMAP = dict[ 1497 'z' => 1, 1498 'n' => 2, 1499 ]; 1500 1501 const type TConstructorShape = shape( 1502 ?'z' => ?string, 1503 ?'n' => ?ComplexString, 1504 ); 1505 1506 const int STRUCTURAL_ID = 2913723608362321564; 1507 /** 1508 * Original thrift field:- 1509 * 1: string z 1510 */ 1511 public string $z; 1512 /** 1513 * Original thrift field:- 1514 * 2: struct module.ComplexString n 1515 */ 1516 public ?ComplexString $n; 1517 1518 public function __construct(?string $z = null, ?ComplexString $n = null )[] { 1519 $this->z = $z ?? "4"; 1520 $this->n = $n; 1521 } 1522 1523 public static function withDefaultValues()[]: this { 1524 return new static(); 1525 } 1526 1527 public static function fromShape(self::TConstructorShape $shape)[]: this { 1528 return new static( 1529 Shapes::idx($shape, 'z'), 1530 Shapes::idx($shape, 'n'), 1531 ); 1532 } 1533 1534 public function getName()[]: string { 1535 return 'ComplexNestedWithDefault'; 1536 } 1537 1538 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 1539 return tmeta_ThriftStruct::fromShape( 1540 shape( 1541 "name" => "module.ComplexNestedWithDefault", 1542 "fields" => vec[ 1543 tmeta_ThriftField::fromShape( 1544 shape( 1545 "id" => 1, 1546 "type" => tmeta_ThriftType::fromShape( 1547 shape( 1548 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 1549 ) 1550 ), 1551 "name" => "z", 1552 ) 1553 ), 1554 tmeta_ThriftField::fromShape( 1555 shape( 1556 "id" => 2, 1557 "type" => tmeta_ThriftType::fromShape( 1558 shape( 1559 "t_struct" => tmeta_ThriftStructType::fromShape( 1560 shape( 1561 "name" => "module.ComplexString", 1562 ) 1563 ), 1564 ) 1565 ), 1566 "name" => "n", 1567 ) 1568 ), 1569 ], 1570 "is_union" => false, 1571 ) 1572 ); 1573 } 1574 1575 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 1576 return shape( 1577 'struct' => dict[], 1578 'fields' => dict[ 1579 ], 1580 ); 1581 } 1582 1583 public function readFromJson(string $jsonText): void { 1584 $parsed = json_decode($jsonText, true); 1585 1586 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 1587 throw new \TProtocolException("Cannot parse the given json string."); 1588 } 1589 1590 if (idx($parsed, 'z') !== null) { 1591 $this->z = /* HH_FIXME[4110] */ $parsed['z']; 1592 } 1593 if (idx($parsed, 'n') !== null) { 1594 $_tmp0 = json_encode(/* HH_FIXME[4110] */ $parsed['n']); 1595 $_tmp1 = ComplexString::withDefaultValues(); 1596 $_tmp1->readFromJson($_tmp0); 1597 $this->n = $_tmp1; 1598 } 1599 } 1600 1601} 1602 1603/** 1604 * Original thrift struct:- 1605 * MinPadding 1606 */ 1607class MinPadding implements \IThriftStruct { 1608 use \ThriftSerializationTrait; 1609 1610 const dict<int, this::TFieldSpec> SPEC = dict[ 1611 1 => shape( 1612 'var' => 'small', 1613 'type' => \TType::BYTE, 1614 ), 1615 2 => shape( 1616 'var' => 'big', 1617 'type' => \TType::I64, 1618 ), 1619 3 => shape( 1620 'var' => 'medium', 1621 'type' => \TType::I16, 1622 ), 1623 4 => shape( 1624 'var' => 'biggish', 1625 'type' => \TType::I32, 1626 ), 1627 5 => shape( 1628 'var' => 'tiny', 1629 'type' => \TType::BYTE, 1630 ), 1631 ]; 1632 const dict<string, int> FIELDMAP = dict[ 1633 'small' => 1, 1634 'big' => 2, 1635 'medium' => 3, 1636 'biggish' => 4, 1637 'tiny' => 5, 1638 ]; 1639 1640 const type TConstructorShape = shape( 1641 ?'small' => ?int, 1642 ?'big' => ?int, 1643 ?'medium' => ?int, 1644 ?'biggish' => ?int, 1645 ?'tiny' => ?int, 1646 ); 1647 1648 const int STRUCTURAL_ID = 723753448680843528; 1649 /** 1650 * Original thrift field:- 1651 * 1: byte small 1652 */ 1653 public int $small; 1654 /** 1655 * Original thrift field:- 1656 * 2: i64 big 1657 */ 1658 public int $big; 1659 /** 1660 * Original thrift field:- 1661 * 3: i16 medium 1662 */ 1663 public int $medium; 1664 /** 1665 * Original thrift field:- 1666 * 4: i32 biggish 1667 */ 1668 public int $biggish; 1669 /** 1670 * Original thrift field:- 1671 * 5: byte tiny 1672 */ 1673 public int $tiny; 1674 1675 public function __construct(?int $small = null, ?int $big = null, ?int $medium = null, ?int $biggish = null, ?int $tiny = null )[] { 1676 $this->small = $small ?? 0; 1677 $this->big = $big ?? 0; 1678 $this->medium = $medium ?? 0; 1679 $this->biggish = $biggish ?? 0; 1680 $this->tiny = $tiny ?? 0; 1681 } 1682 1683 public static function withDefaultValues()[]: this { 1684 return new static(); 1685 } 1686 1687 public static function fromShape(self::TConstructorShape $shape)[]: this { 1688 return new static( 1689 Shapes::idx($shape, 'small'), 1690 Shapes::idx($shape, 'big'), 1691 Shapes::idx($shape, 'medium'), 1692 Shapes::idx($shape, 'biggish'), 1693 Shapes::idx($shape, 'tiny'), 1694 ); 1695 } 1696 1697 public function getName()[]: string { 1698 return 'MinPadding'; 1699 } 1700 1701 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 1702 return tmeta_ThriftStruct::fromShape( 1703 shape( 1704 "name" => "module.MinPadding", 1705 "fields" => vec[ 1706 tmeta_ThriftField::fromShape( 1707 shape( 1708 "id" => 1, 1709 "type" => tmeta_ThriftType::fromShape( 1710 shape( 1711 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BYTE_TYPE, 1712 ) 1713 ), 1714 "name" => "small", 1715 ) 1716 ), 1717 tmeta_ThriftField::fromShape( 1718 shape( 1719 "id" => 2, 1720 "type" => tmeta_ThriftType::fromShape( 1721 shape( 1722 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, 1723 ) 1724 ), 1725 "name" => "big", 1726 ) 1727 ), 1728 tmeta_ThriftField::fromShape( 1729 shape( 1730 "id" => 3, 1731 "type" => tmeta_ThriftType::fromShape( 1732 shape( 1733 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I16_TYPE, 1734 ) 1735 ), 1736 "name" => "medium", 1737 ) 1738 ), 1739 tmeta_ThriftField::fromShape( 1740 shape( 1741 "id" => 4, 1742 "type" => tmeta_ThriftType::fromShape( 1743 shape( 1744 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 1745 ) 1746 ), 1747 "name" => "biggish", 1748 ) 1749 ), 1750 tmeta_ThriftField::fromShape( 1751 shape( 1752 "id" => 5, 1753 "type" => tmeta_ThriftType::fromShape( 1754 shape( 1755 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BYTE_TYPE, 1756 ) 1757 ), 1758 "name" => "tiny", 1759 ) 1760 ), 1761 ], 1762 "is_union" => false, 1763 ) 1764 ); 1765 } 1766 1767 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 1768 return shape( 1769 'struct' => dict[], 1770 'fields' => dict[ 1771 ], 1772 ); 1773 } 1774 1775 public function readFromJson(string $jsonText): void { 1776 $parsed = json_decode($jsonText, true); 1777 1778 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 1779 throw new \TProtocolException("Cannot parse the given json string."); 1780 } 1781 1782 if (idx($parsed, 'small') !== null) { 1783 $_tmp0 = (int)/* HH_FIXME[4110] */ $parsed['small']; 1784 if ($_tmp0 > 0x7f) { 1785 throw new \TProtocolException("number exceeds limit in field"); 1786 } else { 1787 $this->small = (int)$_tmp0; 1788 } 1789 } else { 1790 throw new \TProtocolException("Required field small cannot be found."); 1791 } 1792 if (idx($parsed, 'big') !== null) { 1793 $this->big = /* HH_FIXME[4110] */ $parsed['big']; 1794 } else { 1795 throw new \TProtocolException("Required field big cannot be found."); 1796 } 1797 if (idx($parsed, 'medium') !== null) { 1798 $_tmp1 = (int)/* HH_FIXME[4110] */ $parsed['medium']; 1799 if ($_tmp1 > 0x7fff) { 1800 throw new \TProtocolException("number exceeds limit in field"); 1801 } else { 1802 $this->medium = (int)$_tmp1; 1803 } 1804 } else { 1805 throw new \TProtocolException("Required field medium cannot be found."); 1806 } 1807 if (idx($parsed, 'biggish') !== null) { 1808 $_tmp2 = (int)/* HH_FIXME[4110] */ $parsed['biggish']; 1809 if ($_tmp2 > 0x7fffffff) { 1810 throw new \TProtocolException("number exceeds limit in field"); 1811 } else { 1812 $this->biggish = (int)$_tmp2; 1813 } 1814 } else { 1815 throw new \TProtocolException("Required field biggish cannot be found."); 1816 } 1817 if (idx($parsed, 'tiny') !== null) { 1818 $_tmp3 = (int)/* HH_FIXME[4110] */ $parsed['tiny']; 1819 if ($_tmp3 > 0x7f) { 1820 throw new \TProtocolException("number exceeds limit in field"); 1821 } else { 1822 $this->tiny = (int)$_tmp3; 1823 } 1824 } else { 1825 throw new \TProtocolException("Required field tiny cannot be found."); 1826 } 1827 } 1828 1829} 1830 1831/** 1832 * Original thrift struct:- 1833 * MyStruct 1834 */ 1835class MyStruct implements \IThriftStruct { 1836 use \ThriftSerializationTrait; 1837 1838 const dict<int, this::TFieldSpec> SPEC = dict[ 1839 1 => shape( 1840 'var' => 'MyIntField', 1841 'type' => \TType::I64, 1842 ), 1843 2 => shape( 1844 'var' => 'MyStringField', 1845 'type' => \TType::STRING, 1846 ), 1847 3 => shape( 1848 'var' => 'majorVer', 1849 'type' => \TType::I64, 1850 ), 1851 4 => shape( 1852 'var' => 'data', 1853 'type' => \TType::STRUCT, 1854 'class' => MyDataItem::class, 1855 ), 1856 ]; 1857 const dict<string, int> FIELDMAP = dict[ 1858 'MyIntField' => 1, 1859 'MyStringField' => 2, 1860 'majorVer' => 3, 1861 'data' => 4, 1862 ]; 1863 1864 const type TConstructorShape = shape( 1865 ?'MyIntField' => ?int, 1866 ?'MyStringField' => ?string, 1867 ?'majorVer' => ?int, 1868 ?'data' => ?MyDataItem, 1869 ); 1870 1871 const int STRUCTURAL_ID = 2472338421128341558; 1872 /** 1873 * Original thrift field:- 1874 * 1: i64 MyIntField 1875 */ 1876 public int $MyIntField; 1877 /** 1878 * Original thrift field:- 1879 * 2: string MyStringField 1880 */ 1881 public string $MyStringField; 1882 /** 1883 * Original thrift field:- 1884 * 3: i64 majorVer 1885 */ 1886 public int $majorVer; 1887 /** 1888 * Original thrift field:- 1889 * 4: struct module.MyDataItem data 1890 */ 1891 public ?MyDataItem $data; 1892 1893 public function __construct(?int $MyIntField = null, ?string $MyStringField = null, ?int $majorVer = null, ?MyDataItem $data = null )[] { 1894 $this->MyIntField = $MyIntField ?? 0; 1895 $this->MyStringField = $MyStringField ?? ''; 1896 $this->majorVer = $majorVer ?? 0; 1897 $this->data = $data; 1898 } 1899 1900 public static function withDefaultValues()[]: this { 1901 return new static(); 1902 } 1903 1904 public static function fromShape(self::TConstructorShape $shape)[]: this { 1905 return new static( 1906 Shapes::idx($shape, 'MyIntField'), 1907 Shapes::idx($shape, 'MyStringField'), 1908 Shapes::idx($shape, 'majorVer'), 1909 Shapes::idx($shape, 'data'), 1910 ); 1911 } 1912 1913 public function getName()[]: string { 1914 return 'MyStruct'; 1915 } 1916 1917 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 1918 return tmeta_ThriftStruct::fromShape( 1919 shape( 1920 "name" => "module.MyStruct", 1921 "fields" => vec[ 1922 tmeta_ThriftField::fromShape( 1923 shape( 1924 "id" => 1, 1925 "type" => tmeta_ThriftType::fromShape( 1926 shape( 1927 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, 1928 ) 1929 ), 1930 "name" => "MyIntField", 1931 ) 1932 ), 1933 tmeta_ThriftField::fromShape( 1934 shape( 1935 "id" => 2, 1936 "type" => tmeta_ThriftType::fromShape( 1937 shape( 1938 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 1939 ) 1940 ), 1941 "name" => "MyStringField", 1942 ) 1943 ), 1944 tmeta_ThriftField::fromShape( 1945 shape( 1946 "id" => 3, 1947 "type" => tmeta_ThriftType::fromShape( 1948 shape( 1949 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, 1950 ) 1951 ), 1952 "name" => "majorVer", 1953 ) 1954 ), 1955 tmeta_ThriftField::fromShape( 1956 shape( 1957 "id" => 4, 1958 "type" => tmeta_ThriftType::fromShape( 1959 shape( 1960 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 1961 shape( 1962 "name" => "module.MyDataItem", 1963 "underlyingType" => tmeta_ThriftType::fromShape( 1964 shape( 1965 "t_struct" => tmeta_ThriftStructType::fromShape( 1966 shape( 1967 "name" => "module.MyDataItem", 1968 ) 1969 ), 1970 ) 1971 ), 1972 ) 1973 ), 1974 ) 1975 ), 1976 "name" => "data", 1977 ) 1978 ), 1979 ], 1980 "is_union" => false, 1981 ) 1982 ); 1983 } 1984 1985 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 1986 return shape( 1987 'struct' => dict[], 1988 'fields' => dict[ 1989 ], 1990 ); 1991 } 1992 1993 public function readFromJson(string $jsonText): void { 1994 $parsed = json_decode($jsonText, true); 1995 1996 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 1997 throw new \TProtocolException("Cannot parse the given json string."); 1998 } 1999 2000 if (idx($parsed, 'MyIntField') !== null) { 2001 $this->MyIntField = /* HH_FIXME[4110] */ $parsed['MyIntField']; 2002 } 2003 if (idx($parsed, 'MyStringField') !== null) { 2004 $this->MyStringField = /* HH_FIXME[4110] */ $parsed['MyStringField']; 2005 } 2006 if (idx($parsed, 'majorVer') !== null) { 2007 $this->majorVer = /* HH_FIXME[4110] */ $parsed['majorVer']; 2008 } 2009 if (idx($parsed, 'data') !== null) { 2010 $_tmp0 = json_encode(/* HH_FIXME[4110] */ $parsed['data']); 2011 $_tmp1 = MyDataItem::withDefaultValues(); 2012 $_tmp1->readFromJson($_tmp0); 2013 $this->data = $_tmp1; 2014 } 2015 } 2016 2017} 2018 2019/** 2020 * Original thrift struct:- 2021 * MyDataItem 2022 */ 2023class MyDataItem implements \IThriftStruct { 2024 use \ThriftSerializationTrait; 2025 2026 const dict<int, this::TFieldSpec> SPEC = dict[ 2027 ]; 2028 const dict<string, int> FIELDMAP = dict[ 2029 ]; 2030 2031 const type TConstructorShape = shape( 2032 ); 2033 2034 const int STRUCTURAL_ID = 957977401221134810; 2035 2036 public function __construct( )[] { 2037 } 2038 2039 public static function withDefaultValues()[]: this { 2040 return new static(); 2041 } 2042 2043 public static function fromShape(self::TConstructorShape $shape)[]: this { 2044 return new static( 2045 ); 2046 } 2047 2048 public function getName()[]: string { 2049 return 'MyDataItem'; 2050 } 2051 2052 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 2053 return tmeta_ThriftStruct::fromShape( 2054 shape( 2055 "name" => "module.MyDataItem", 2056 "is_union" => false, 2057 ) 2058 ); 2059 } 2060 2061 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 2062 return shape( 2063 'struct' => dict[], 2064 'fields' => dict[ 2065 ], 2066 ); 2067 } 2068 2069 public function readFromJson(string $jsonText): void { 2070 $parsed = json_decode($jsonText, true); 2071 2072 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 2073 throw new \TProtocolException("Cannot parse the given json string."); 2074 } 2075 2076 } 2077 2078} 2079 2080/** 2081 * Original thrift struct:- 2082 * Renaming 2083 */ 2084class Renaming implements \IThriftStruct { 2085 use \ThriftSerializationTrait; 2086 2087 const dict<int, this::TFieldSpec> SPEC = dict[ 2088 1 => shape( 2089 'var' => 'foo', 2090 'type' => \TType::I64, 2091 ), 2092 ]; 2093 const dict<string, int> FIELDMAP = dict[ 2094 'foo' => 1, 2095 ]; 2096 2097 const type TConstructorShape = shape( 2098 ?'foo' => ?int, 2099 ); 2100 2101 const int STRUCTURAL_ID = 2811793053530639830; 2102 /** 2103 * Original thrift field:- 2104 * 1: i64 foo 2105 */ 2106 public int $foo; 2107 2108 public function __construct(?int $foo = null )[] { 2109 $this->foo = $foo ?? 0; 2110 } 2111 2112 public static function withDefaultValues()[]: this { 2113 return new static(); 2114 } 2115 2116 public static function fromShape(self::TConstructorShape $shape)[]: this { 2117 return new static( 2118 Shapes::idx($shape, 'foo'), 2119 ); 2120 } 2121 2122 public function getName()[]: string { 2123 return 'Renaming'; 2124 } 2125 2126 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 2127 return tmeta_ThriftStruct::fromShape( 2128 shape( 2129 "name" => "module.Renaming", 2130 "fields" => vec[ 2131 tmeta_ThriftField::fromShape( 2132 shape( 2133 "id" => 1, 2134 "type" => tmeta_ThriftType::fromShape( 2135 shape( 2136 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, 2137 ) 2138 ), 2139 "name" => "foo", 2140 ) 2141 ), 2142 ], 2143 "is_union" => false, 2144 ) 2145 ); 2146 } 2147 2148 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 2149 return shape( 2150 'struct' => dict[], 2151 'fields' => dict[ 2152 ], 2153 ); 2154 } 2155 2156 public function readFromJson(string $jsonText): void { 2157 $parsed = json_decode($jsonText, true); 2158 2159 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 2160 throw new \TProtocolException("Cannot parse the given json string."); 2161 } 2162 2163 if (idx($parsed, 'foo') !== null) { 2164 $this->foo = /* HH_FIXME[4110] */ $parsed['foo']; 2165 } 2166 } 2167 2168} 2169 2170/** 2171 * Original thrift struct:- 2172 * AnnotatedTypes 2173 */ 2174class AnnotatedTypes implements \IThriftStruct { 2175 use \ThriftSerializationTrait; 2176 2177 const dict<int, this::TFieldSpec> SPEC = dict[ 2178 1 => shape( 2179 'var' => 'binary_field', 2180 'type' => \TType::STRING, 2181 ), 2182 2 => shape( 2183 'var' => 'list_field', 2184 'type' => \TType::LST, 2185 'etype' => \TType::MAP, 2186 'elem' => shape( 2187 'type' => \TType::MAP, 2188 'ktype' => \TType::I32, 2189 'vtype' => \TType::STRING, 2190 'key' => shape( 2191 'type' => \TType::I32, 2192 ), 2193 'val' => shape( 2194 'type' => \TType::STRING, 2195 ), 2196 'format' => 'collection', 2197 ), 2198 'format' => 'collection', 2199 ), 2200 ]; 2201 const dict<string, int> FIELDMAP = dict[ 2202 'binary_field' => 1, 2203 'list_field' => 2, 2204 ]; 2205 2206 const type TConstructorShape = shape( 2207 ?'binary_field' => ?string, 2208 ?'list_field' => ?Vector<Map<int, string>>, 2209 ); 2210 2211 const int STRUCTURAL_ID = 7799859984459418183; 2212 /** 2213 * Original thrift field:- 2214 * 1: binary binary_field 2215 */ 2216 public string $binary_field; 2217 /** 2218 * Original thrift field:- 2219 * 2: list<map<i32, string>> list_field 2220 */ 2221 public Vector<Map<int, string>> $list_field; 2222 2223 public function __construct(?string $binary_field = null, ?Vector<Map<int, string>> $list_field = null )[] { 2224 $this->binary_field = $binary_field ?? ''; 2225 $this->list_field = $list_field ?? Vector {}; 2226 } 2227 2228 public static function withDefaultValues()[]: this { 2229 return new static(); 2230 } 2231 2232 public static function fromShape(self::TConstructorShape $shape)[]: this { 2233 return new static( 2234 Shapes::idx($shape, 'binary_field'), 2235 Shapes::idx($shape, 'list_field'), 2236 ); 2237 } 2238 2239 public function getName()[]: string { 2240 return 'AnnotatedTypes'; 2241 } 2242 2243 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 2244 return tmeta_ThriftStruct::fromShape( 2245 shape( 2246 "name" => "module.AnnotatedTypes", 2247 "fields" => vec[ 2248 tmeta_ThriftField::fromShape( 2249 shape( 2250 "id" => 1, 2251 "type" => tmeta_ThriftType::fromShape( 2252 shape( 2253 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 2254 shape( 2255 "name" => "module.TBinary", 2256 "underlyingType" => tmeta_ThriftType::fromShape( 2257 shape( 2258 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 2259 shape( 2260 "name" => "module.TBinary", 2261 "underlyingType" => tmeta_ThriftType::fromShape( 2262 shape( 2263 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, 2264 ) 2265 ), 2266 ) 2267 ), 2268 ) 2269 ), 2270 ) 2271 ), 2272 ) 2273 ), 2274 "name" => "binary_field", 2275 ) 2276 ), 2277 tmeta_ThriftField::fromShape( 2278 shape( 2279 "id" => 2, 2280 "type" => tmeta_ThriftType::fromShape( 2281 shape( 2282 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 2283 shape( 2284 "name" => "include.SomeListOfTypeMap", 2285 "underlyingType" => tmeta_ThriftType::fromShape( 2286 shape( 2287 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 2288 shape( 2289 "name" => "include.SomeListOfTypeMap", 2290 "underlyingType" => tmeta_ThriftType::fromShape( 2291 shape( 2292 "t_list" => tmeta_ThriftListType::fromShape( 2293 shape( 2294 "valueType" => tmeta_ThriftType::fromShape( 2295 shape( 2296 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 2297 shape( 2298 "name" => "include.SomeMap", 2299 "underlyingType" => tmeta_ThriftType::fromShape( 2300 shape( 2301 "t_map" => tmeta_ThriftMapType::fromShape( 2302 shape( 2303 "keyType" => tmeta_ThriftType::fromShape( 2304 shape( 2305 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 2306 ) 2307 ), 2308 "valueType" => tmeta_ThriftType::fromShape( 2309 shape( 2310 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 2311 ) 2312 ), 2313 ) 2314 ), 2315 ) 2316 ), 2317 ) 2318 ), 2319 ) 2320 ), 2321 ) 2322 ), 2323 ) 2324 ), 2325 ) 2326 ), 2327 ) 2328 ), 2329 ) 2330 ), 2331 ) 2332 ), 2333 "name" => "list_field", 2334 ) 2335 ), 2336 ], 2337 "is_union" => false, 2338 ) 2339 ); 2340 } 2341 2342 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 2343 return shape( 2344 'struct' => dict[], 2345 'fields' => dict[ 2346 ], 2347 ); 2348 } 2349 2350 public function readFromJson(string $jsonText): void { 2351 $parsed = json_decode($jsonText, true); 2352 2353 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 2354 throw new \TProtocolException("Cannot parse the given json string."); 2355 } 2356 2357 if (idx($parsed, 'binary_field') !== null) { 2358 $this->binary_field = /* HH_FIXME[4110] */ $parsed['binary_field']; 2359 } 2360 if (idx($parsed, 'list_field') !== null) { 2361 $_json3 = /* HH_FIXME[4110] */ $parsed['list_field']; 2362 $_container4 = Vector {}; 2363 foreach(/* HH_FIXME[4110] */ $_json3 as $_key1 => $_value2) { 2364 $_elem5 = Map {}; 2365 $_json9 = $_value2; 2366 $_container10 = Map {}; 2367 foreach(/* HH_FIXME[4110] */ $_json9 as $_key7 => $_value8) { 2368 $_value11 = ''; 2369 $_value11 = $_value8; 2370 $_container10[$_key7] = $_value11; 2371 } 2372 $_elem5 = $_container10; 2373 $_container4 []= $_elem5; 2374 } 2375 $this->list_field = $_container4; 2376 } 2377 } 2378 2379} 2380 2381/** 2382 * Original thrift struct:- 2383 * ForwardUsageRoot 2384 */ 2385class ForwardUsageRoot implements \IThriftStruct { 2386 use \ThriftSerializationTrait; 2387 2388 const dict<int, this::TFieldSpec> SPEC = dict[ 2389 1 => shape( 2390 'var' => 'ForwardUsageStruct', 2391 'type' => \TType::STRUCT, 2392 'class' => ForwardUsageStruct::class, 2393 ), 2394 2 => shape( 2395 'var' => 'ForwardUsageByRef', 2396 'type' => \TType::STRUCT, 2397 'class' => ForwardUsageByRef::class, 2398 ), 2399 ]; 2400 const dict<string, int> FIELDMAP = dict[ 2401 'ForwardUsageStruct' => 1, 2402 'ForwardUsageByRef' => 2, 2403 ]; 2404 2405 const type TConstructorShape = shape( 2406 ?'ForwardUsageStruct' => ?ForwardUsageStruct, 2407 ?'ForwardUsageByRef' => ?ForwardUsageByRef, 2408 ); 2409 2410 const int STRUCTURAL_ID = 839155360071855827; 2411 /** 2412 * Original thrift field:- 2413 * 1: struct module.ForwardUsageStruct ForwardUsageStruct 2414 */ 2415 public ?ForwardUsageStruct $ForwardUsageStruct; 2416 /** 2417 * Original thrift field:- 2418 * 2: struct module.ForwardUsageByRef ForwardUsageByRef 2419 */ 2420 public ?ForwardUsageByRef $ForwardUsageByRef; 2421 2422 public function __construct(?ForwardUsageStruct $ForwardUsageStruct = null, ?ForwardUsageByRef $ForwardUsageByRef = null )[] { 2423 $this->ForwardUsageStruct = $ForwardUsageStruct; 2424 $this->ForwardUsageByRef = $ForwardUsageByRef; 2425 } 2426 2427 public static function withDefaultValues()[]: this { 2428 return new static(); 2429 } 2430 2431 public static function fromShape(self::TConstructorShape $shape)[]: this { 2432 return new static( 2433 Shapes::idx($shape, 'ForwardUsageStruct'), 2434 Shapes::idx($shape, 'ForwardUsageByRef'), 2435 ); 2436 } 2437 2438 public function getName()[]: string { 2439 return 'ForwardUsageRoot'; 2440 } 2441 2442 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 2443 return tmeta_ThriftStruct::fromShape( 2444 shape( 2445 "name" => "module.ForwardUsageRoot", 2446 "fields" => vec[ 2447 tmeta_ThriftField::fromShape( 2448 shape( 2449 "id" => 1, 2450 "type" => tmeta_ThriftType::fromShape( 2451 shape( 2452 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 2453 shape( 2454 "name" => "module.ForwardUsageStruct", 2455 "underlyingType" => tmeta_ThriftType::fromShape( 2456 shape( 2457 "t_struct" => tmeta_ThriftStructType::fromShape( 2458 shape( 2459 "name" => "module.ForwardUsageStruct", 2460 ) 2461 ), 2462 ) 2463 ), 2464 ) 2465 ), 2466 ) 2467 ), 2468 "name" => "ForwardUsageStruct", 2469 "is_optional" => true, 2470 ) 2471 ), 2472 tmeta_ThriftField::fromShape( 2473 shape( 2474 "id" => 2, 2475 "type" => tmeta_ThriftType::fromShape( 2476 shape( 2477 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 2478 shape( 2479 "name" => "module.ForwardUsageByRef", 2480 "underlyingType" => tmeta_ThriftType::fromShape( 2481 shape( 2482 "t_struct" => tmeta_ThriftStructType::fromShape( 2483 shape( 2484 "name" => "module.ForwardUsageByRef", 2485 ) 2486 ), 2487 ) 2488 ), 2489 ) 2490 ), 2491 ) 2492 ), 2493 "name" => "ForwardUsageByRef", 2494 "is_optional" => true, 2495 ) 2496 ), 2497 ], 2498 "is_union" => false, 2499 ) 2500 ); 2501 } 2502 2503 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 2504 return shape( 2505 'struct' => dict[], 2506 'fields' => dict[ 2507 ], 2508 ); 2509 } 2510 2511 public function readFromJson(string $jsonText): void { 2512 $parsed = json_decode($jsonText, true); 2513 2514 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 2515 throw new \TProtocolException("Cannot parse the given json string."); 2516 } 2517 2518 if (idx($parsed, 'ForwardUsageStruct') !== null) { 2519 $_tmp0 = json_encode(/* HH_FIXME[4110] */ $parsed['ForwardUsageStruct']); 2520 $_tmp1 = ForwardUsageStruct::withDefaultValues(); 2521 $_tmp1->readFromJson($_tmp0); 2522 $this->ForwardUsageStruct = $_tmp1; 2523 } 2524 if (idx($parsed, 'ForwardUsageByRef') !== null) { 2525 $_tmp2 = json_encode(/* HH_FIXME[4110] */ $parsed['ForwardUsageByRef']); 2526 $_tmp3 = ForwardUsageByRef::withDefaultValues(); 2527 $_tmp3->readFromJson($_tmp2); 2528 $this->ForwardUsageByRef = $_tmp3; 2529 } 2530 } 2531 2532} 2533 2534/** 2535 * Original thrift struct:- 2536 * ForwardUsageStruct 2537 */ 2538class ForwardUsageStruct implements \IThriftStruct { 2539 use \ThriftSerializationTrait; 2540 2541 const dict<int, this::TFieldSpec> SPEC = dict[ 2542 1 => shape( 2543 'var' => 'foo', 2544 'type' => \TType::STRUCT, 2545 'class' => ForwardUsageRoot::class, 2546 ), 2547 ]; 2548 const dict<string, int> FIELDMAP = dict[ 2549 'foo' => 1, 2550 ]; 2551 2552 const type TConstructorShape = shape( 2553 ?'foo' => ?ForwardUsageRoot, 2554 ); 2555 2556 const int STRUCTURAL_ID = 7148256645166217470; 2557 /** 2558 * Original thrift field:- 2559 * 1: struct module.ForwardUsageRoot foo 2560 */ 2561 public ?ForwardUsageRoot $foo; 2562 2563 public function __construct(?ForwardUsageRoot $foo = null )[] { 2564 $this->foo = $foo; 2565 } 2566 2567 public static function withDefaultValues()[]: this { 2568 return new static(); 2569 } 2570 2571 public static function fromShape(self::TConstructorShape $shape)[]: this { 2572 return new static( 2573 Shapes::idx($shape, 'foo'), 2574 ); 2575 } 2576 2577 public function getName()[]: string { 2578 return 'ForwardUsageStruct'; 2579 } 2580 2581 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 2582 return tmeta_ThriftStruct::fromShape( 2583 shape( 2584 "name" => "module.ForwardUsageStruct", 2585 "fields" => vec[ 2586 tmeta_ThriftField::fromShape( 2587 shape( 2588 "id" => 1, 2589 "type" => tmeta_ThriftType::fromShape( 2590 shape( 2591 "t_struct" => tmeta_ThriftStructType::fromShape( 2592 shape( 2593 "name" => "module.ForwardUsageRoot", 2594 ) 2595 ), 2596 ) 2597 ), 2598 "name" => "foo", 2599 "is_optional" => true, 2600 ) 2601 ), 2602 ], 2603 "is_union" => false, 2604 ) 2605 ); 2606 } 2607 2608 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 2609 return shape( 2610 'struct' => dict[], 2611 'fields' => dict[ 2612 ], 2613 ); 2614 } 2615 2616 public function readFromJson(string $jsonText): void { 2617 $parsed = json_decode($jsonText, true); 2618 2619 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 2620 throw new \TProtocolException("Cannot parse the given json string."); 2621 } 2622 2623 if (idx($parsed, 'foo') !== null) { 2624 $_tmp0 = json_encode(/* HH_FIXME[4110] */ $parsed['foo']); 2625 $_tmp1 = ForwardUsageRoot::withDefaultValues(); 2626 $_tmp1->readFromJson($_tmp0); 2627 $this->foo = $_tmp1; 2628 } 2629 } 2630 2631} 2632 2633/** 2634 * Original thrift struct:- 2635 * ForwardUsageByRef 2636 */ 2637class ForwardUsageByRef implements \IThriftStruct { 2638 use \ThriftSerializationTrait; 2639 2640 const dict<int, this::TFieldSpec> SPEC = dict[ 2641 1 => shape( 2642 'var' => 'foo', 2643 'type' => \TType::STRUCT, 2644 'class' => ForwardUsageRoot::class, 2645 ), 2646 ]; 2647 const dict<string, int> FIELDMAP = dict[ 2648 'foo' => 1, 2649 ]; 2650 2651 const type TConstructorShape = shape( 2652 ?'foo' => ?ForwardUsageRoot, 2653 ); 2654 2655 const int STRUCTURAL_ID = 7148256645166217470; 2656 /** 2657 * Original thrift field:- 2658 * 1: struct module.ForwardUsageRoot foo 2659 */ 2660 public ?ForwardUsageRoot $foo; 2661 2662 public function __construct(?ForwardUsageRoot $foo = null )[] { 2663 $this->foo = $foo; 2664 } 2665 2666 public static function withDefaultValues()[]: this { 2667 return new static(); 2668 } 2669 2670 public static function fromShape(self::TConstructorShape $shape)[]: this { 2671 return new static( 2672 Shapes::idx($shape, 'foo'), 2673 ); 2674 } 2675 2676 public function getName()[]: string { 2677 return 'ForwardUsageByRef'; 2678 } 2679 2680 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 2681 return tmeta_ThriftStruct::fromShape( 2682 shape( 2683 "name" => "module.ForwardUsageByRef", 2684 "fields" => vec[ 2685 tmeta_ThriftField::fromShape( 2686 shape( 2687 "id" => 1, 2688 "type" => tmeta_ThriftType::fromShape( 2689 shape( 2690 "t_struct" => tmeta_ThriftStructType::fromShape( 2691 shape( 2692 "name" => "module.ForwardUsageRoot", 2693 ) 2694 ), 2695 ) 2696 ), 2697 "name" => "foo", 2698 "is_optional" => true, 2699 ) 2700 ), 2701 ], 2702 "is_union" => false, 2703 ) 2704 ); 2705 } 2706 2707 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 2708 return shape( 2709 'struct' => dict[], 2710 'fields' => dict[ 2711 ], 2712 ); 2713 } 2714 2715 public function readFromJson(string $jsonText): void { 2716 $parsed = json_decode($jsonText, true); 2717 2718 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 2719 throw new \TProtocolException("Cannot parse the given json string."); 2720 } 2721 2722 if (idx($parsed, 'foo') !== null) { 2723 $_tmp0 = json_encode(/* HH_FIXME[4110] */ $parsed['foo']); 2724 $_tmp1 = ForwardUsageRoot::withDefaultValues(); 2725 $_tmp1->readFromJson($_tmp0); 2726 $this->foo = $_tmp1; 2727 } 2728 } 2729 2730} 2731 2732/** 2733 * Original thrift struct:- 2734 * NoexceptMoveEmpty 2735 */ 2736class NoexceptMoveEmpty implements \IThriftStruct { 2737 use \ThriftSerializationTrait; 2738 2739 const dict<int, this::TFieldSpec> SPEC = dict[ 2740 ]; 2741 const dict<string, int> FIELDMAP = dict[ 2742 ]; 2743 2744 const type TConstructorShape = shape( 2745 ); 2746 2747 const int STRUCTURAL_ID = 957977401221134810; 2748 2749 public function __construct( )[] { 2750 } 2751 2752 public static function withDefaultValues()[]: this { 2753 return new static(); 2754 } 2755 2756 public static function fromShape(self::TConstructorShape $shape)[]: this { 2757 return new static( 2758 ); 2759 } 2760 2761 public function getName()[]: string { 2762 return 'NoexceptMoveEmpty'; 2763 } 2764 2765 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 2766 return tmeta_ThriftStruct::fromShape( 2767 shape( 2768 "name" => "module.NoexceptMoveEmpty", 2769 "is_union" => false, 2770 ) 2771 ); 2772 } 2773 2774 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 2775 return shape( 2776 'struct' => dict[], 2777 'fields' => dict[ 2778 ], 2779 ); 2780 } 2781 2782 public function readFromJson(string $jsonText): void { 2783 $parsed = json_decode($jsonText, true); 2784 2785 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 2786 throw new \TProtocolException("Cannot parse the given json string."); 2787 } 2788 2789 } 2790 2791} 2792 2793/** 2794 * Original thrift struct:- 2795 * NoexceptMoveSimpleStruct 2796 */ 2797class NoexceptMoveSimpleStruct implements \IThriftStruct { 2798 use \ThriftSerializationTrait; 2799 2800 const dict<int, this::TFieldSpec> SPEC = dict[ 2801 1 => shape( 2802 'var' => 'boolField', 2803 'type' => \TType::I64, 2804 ), 2805 ]; 2806 const dict<string, int> FIELDMAP = dict[ 2807 'boolField' => 1, 2808 ]; 2809 2810 const type TConstructorShape = shape( 2811 ?'boolField' => ?int, 2812 ); 2813 2814 const int STRUCTURAL_ID = 7058232826271171943; 2815 /** 2816 * Original thrift field:- 2817 * 1: i64 boolField 2818 */ 2819 public int $boolField; 2820 2821 public function __construct(?int $boolField = null )[] { 2822 $this->boolField = $boolField ?? 0; 2823 } 2824 2825 public static function withDefaultValues()[]: this { 2826 return new static(); 2827 } 2828 2829 public static function fromShape(self::TConstructorShape $shape)[]: this { 2830 return new static( 2831 Shapes::idx($shape, 'boolField'), 2832 ); 2833 } 2834 2835 public function getName()[]: string { 2836 return 'NoexceptMoveSimpleStruct'; 2837 } 2838 2839 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 2840 return tmeta_ThriftStruct::fromShape( 2841 shape( 2842 "name" => "module.NoexceptMoveSimpleStruct", 2843 "fields" => vec[ 2844 tmeta_ThriftField::fromShape( 2845 shape( 2846 "id" => 1, 2847 "type" => tmeta_ThriftType::fromShape( 2848 shape( 2849 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, 2850 ) 2851 ), 2852 "name" => "boolField", 2853 ) 2854 ), 2855 ], 2856 "is_union" => false, 2857 ) 2858 ); 2859 } 2860 2861 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 2862 return shape( 2863 'struct' => dict[], 2864 'fields' => dict[ 2865 ], 2866 ); 2867 } 2868 2869 public function readFromJson(string $jsonText): void { 2870 $parsed = json_decode($jsonText, true); 2871 2872 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 2873 throw new \TProtocolException("Cannot parse the given json string."); 2874 } 2875 2876 if (idx($parsed, 'boolField') !== null) { 2877 $this->boolField = /* HH_FIXME[4110] */ $parsed['boolField']; 2878 } 2879 } 2880 2881} 2882 2883/** 2884 * Original thrift struct:- 2885 * NoexceptMoveComplexStruct 2886 */ 2887class NoexceptMoveComplexStruct implements \IThriftStruct { 2888 use \ThriftSerializationTrait; 2889 2890 const dict<int, this::TFieldSpec> SPEC = dict[ 2891 1 => shape( 2892 'var' => 'MyBoolField', 2893 'type' => \TType::BOOL, 2894 ), 2895 2 => shape( 2896 'var' => 'MyIntField', 2897 'type' => \TType::I64, 2898 ), 2899 3 => shape( 2900 'var' => 'MyStringField', 2901 'type' => \TType::STRING, 2902 ), 2903 4 => shape( 2904 'var' => 'MyStringField2', 2905 'type' => \TType::STRING, 2906 ), 2907 5 => shape( 2908 'var' => 'MyBinaryField', 2909 'type' => \TType::STRING, 2910 ), 2911 6 => shape( 2912 'var' => 'MyBinaryField2', 2913 'type' => \TType::STRING, 2914 ), 2915 7 => shape( 2916 'var' => 'MyBinaryField3', 2917 'type' => \TType::STRING, 2918 ), 2919 8 => shape( 2920 'var' => 'MyBinaryListField4', 2921 'type' => \TType::LST, 2922 'etype' => \TType::STRING, 2923 'elem' => shape( 2924 'type' => \TType::STRING, 2925 ), 2926 'format' => 'collection', 2927 ), 2928 9 => shape( 2929 'var' => 'MyMapEnumAndInt', 2930 'type' => \TType::MAP, 2931 'ktype' => \TType::I32, 2932 'vtype' => \TType::STRING, 2933 'key' => shape( 2934 'type' => \TType::I32, 2935 'enum' => MyEnumA::class, 2936 ), 2937 'val' => shape( 2938 'type' => \TType::STRING, 2939 ), 2940 'format' => 'collection', 2941 ), 2942 ]; 2943 const dict<string, int> FIELDMAP = dict[ 2944 'MyBoolField' => 1, 2945 'MyIntField' => 2, 2946 'MyStringField' => 3, 2947 'MyStringField2' => 4, 2948 'MyBinaryField' => 5, 2949 'MyBinaryField2' => 6, 2950 'MyBinaryField3' => 7, 2951 'MyBinaryListField4' => 8, 2952 'MyMapEnumAndInt' => 9, 2953 ]; 2954 2955 const type TConstructorShape = shape( 2956 ?'MyBoolField' => ?bool, 2957 ?'MyIntField' => ?int, 2958 ?'MyStringField' => ?string, 2959 ?'MyStringField2' => ?string, 2960 ?'MyBinaryField' => ?string, 2961 ?'MyBinaryField2' => ?string, 2962 ?'MyBinaryField3' => ?string, 2963 ?'MyBinaryListField4' => ?Vector<string>, 2964 ?'MyMapEnumAndInt' => ?Map<MyEnumA, string>, 2965 ); 2966 2967 const int STRUCTURAL_ID = 8958221528844030164; 2968 /** 2969 * Original thrift field:- 2970 * 1: bool MyBoolField 2971 */ 2972 public bool $MyBoolField; 2973 /** 2974 * Original thrift field:- 2975 * 2: i64 MyIntField 2976 */ 2977 public int $MyIntField; 2978 /** 2979 * Original thrift field:- 2980 * 3: string MyStringField 2981 */ 2982 public string $MyStringField; 2983 /** 2984 * Original thrift field:- 2985 * 4: string MyStringField2 2986 */ 2987 public string $MyStringField2; 2988 /** 2989 * Original thrift field:- 2990 * 5: binary MyBinaryField 2991 */ 2992 public string $MyBinaryField; 2993 /** 2994 * Original thrift field:- 2995 * 6: binary MyBinaryField2 2996 */ 2997 public ?string $MyBinaryField2; 2998 /** 2999 * Original thrift field:- 3000 * 7: binary MyBinaryField3 3001 */ 3002 public string $MyBinaryField3; 3003 /** 3004 * Original thrift field:- 3005 * 8: list<binary> MyBinaryListField4 3006 */ 3007 public Vector<string> $MyBinaryListField4; 3008 /** 3009 * Original thrift field:- 3010 * 9: map<enum module.MyEnumA, string> MyMapEnumAndInt 3011 */ 3012 public Map<MyEnumA, string> $MyMapEnumAndInt; 3013 3014 public function __construct(?bool $MyBoolField = null, ?int $MyIntField = null, ?string $MyStringField = null, ?string $MyStringField2 = null, ?string $MyBinaryField = null, ?string $MyBinaryField2 = null, ?string $MyBinaryField3 = null, ?Vector<string> $MyBinaryListField4 = null, ?Map<MyEnumA, string> $MyMapEnumAndInt = null )[] { 3015 $this->MyBoolField = $MyBoolField ?? false; 3016 $this->MyIntField = $MyIntField ?? 12; 3017 $this->MyStringField = $MyStringField ?? "test"; 3018 $this->MyStringField2 = $MyStringField2 ?? ''; 3019 $this->MyBinaryField = $MyBinaryField ?? ''; 3020 $this->MyBinaryField2 = $MyBinaryField2; 3021 $this->MyBinaryField3 = $MyBinaryField3 ?? ''; 3022 $this->MyBinaryListField4 = $MyBinaryListField4 ?? Vector {}; 3023 $this->MyMapEnumAndInt = $MyMapEnumAndInt ?? Map { 3024 MyEnumA::fieldA => "fieldA", 3025 MyEnumA::fieldC => "fieldC", 3026 }; 3027 } 3028 3029 public static function withDefaultValues()[]: this { 3030 return new static(); 3031 } 3032 3033 public static function fromShape(self::TConstructorShape $shape)[]: this { 3034 return new static( 3035 Shapes::idx($shape, 'MyBoolField'), 3036 Shapes::idx($shape, 'MyIntField'), 3037 Shapes::idx($shape, 'MyStringField'), 3038 Shapes::idx($shape, 'MyStringField2'), 3039 Shapes::idx($shape, 'MyBinaryField'), 3040 Shapes::idx($shape, 'MyBinaryField2'), 3041 Shapes::idx($shape, 'MyBinaryField3'), 3042 Shapes::idx($shape, 'MyBinaryListField4'), 3043 Shapes::idx($shape, 'MyMapEnumAndInt'), 3044 ); 3045 } 3046 3047 public function getName()[]: string { 3048 return 'NoexceptMoveComplexStruct'; 3049 } 3050 3051 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 3052 return tmeta_ThriftStruct::fromShape( 3053 shape( 3054 "name" => "module.NoexceptMoveComplexStruct", 3055 "fields" => vec[ 3056 tmeta_ThriftField::fromShape( 3057 shape( 3058 "id" => 1, 3059 "type" => tmeta_ThriftType::fromShape( 3060 shape( 3061 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BOOL_TYPE, 3062 ) 3063 ), 3064 "name" => "MyBoolField", 3065 ) 3066 ), 3067 tmeta_ThriftField::fromShape( 3068 shape( 3069 "id" => 2, 3070 "type" => tmeta_ThriftType::fromShape( 3071 shape( 3072 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I64_TYPE, 3073 ) 3074 ), 3075 "name" => "MyIntField", 3076 ) 3077 ), 3078 tmeta_ThriftField::fromShape( 3079 shape( 3080 "id" => 3, 3081 "type" => tmeta_ThriftType::fromShape( 3082 shape( 3083 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 3084 ) 3085 ), 3086 "name" => "MyStringField", 3087 ) 3088 ), 3089 tmeta_ThriftField::fromShape( 3090 shape( 3091 "id" => 4, 3092 "type" => tmeta_ThriftType::fromShape( 3093 shape( 3094 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 3095 ) 3096 ), 3097 "name" => "MyStringField2", 3098 ) 3099 ), 3100 tmeta_ThriftField::fromShape( 3101 shape( 3102 "id" => 5, 3103 "type" => tmeta_ThriftType::fromShape( 3104 shape( 3105 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, 3106 ) 3107 ), 3108 "name" => "MyBinaryField", 3109 ) 3110 ), 3111 tmeta_ThriftField::fromShape( 3112 shape( 3113 "id" => 6, 3114 "type" => tmeta_ThriftType::fromShape( 3115 shape( 3116 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, 3117 ) 3118 ), 3119 "name" => "MyBinaryField2", 3120 "is_optional" => true, 3121 ) 3122 ), 3123 tmeta_ThriftField::fromShape( 3124 shape( 3125 "id" => 7, 3126 "type" => tmeta_ThriftType::fromShape( 3127 shape( 3128 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, 3129 ) 3130 ), 3131 "name" => "MyBinaryField3", 3132 ) 3133 ), 3134 tmeta_ThriftField::fromShape( 3135 shape( 3136 "id" => 8, 3137 "type" => tmeta_ThriftType::fromShape( 3138 shape( 3139 "t_list" => tmeta_ThriftListType::fromShape( 3140 shape( 3141 "valueType" => tmeta_ThriftType::fromShape( 3142 shape( 3143 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_BINARY_TYPE, 3144 ) 3145 ), 3146 ) 3147 ), 3148 ) 3149 ), 3150 "name" => "MyBinaryListField4", 3151 ) 3152 ), 3153 tmeta_ThriftField::fromShape( 3154 shape( 3155 "id" => 9, 3156 "type" => tmeta_ThriftType::fromShape( 3157 shape( 3158 "t_map" => tmeta_ThriftMapType::fromShape( 3159 shape( 3160 "keyType" => tmeta_ThriftType::fromShape( 3161 shape( 3162 "t_enum" => tmeta_ThriftEnumType::fromShape( 3163 shape( 3164 "name" => "module.MyEnumA", 3165 ) 3166 ), 3167 ) 3168 ), 3169 "valueType" => tmeta_ThriftType::fromShape( 3170 shape( 3171 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 3172 ) 3173 ), 3174 ) 3175 ), 3176 ) 3177 ), 3178 "name" => "MyMapEnumAndInt", 3179 ) 3180 ), 3181 ], 3182 "is_union" => false, 3183 ) 3184 ); 3185 } 3186 3187 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 3188 return shape( 3189 'struct' => dict[], 3190 'fields' => dict[ 3191 ], 3192 ); 3193 } 3194 3195 public function readFromJson(string $jsonText): void { 3196 $parsed = json_decode($jsonText, true); 3197 3198 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 3199 throw new \TProtocolException("Cannot parse the given json string."); 3200 } 3201 3202 if (idx($parsed, 'MyBoolField') !== null) { 3203 $this->MyBoolField = /* HH_FIXME[4110] */ $parsed['MyBoolField']; 3204 } 3205 if (idx($parsed, 'MyIntField') !== null) { 3206 $this->MyIntField = /* HH_FIXME[4110] */ $parsed['MyIntField']; 3207 } 3208 if (idx($parsed, 'MyStringField') !== null) { 3209 $this->MyStringField = /* HH_FIXME[4110] */ $parsed['MyStringField']; 3210 } 3211 if (idx($parsed, 'MyStringField2') !== null) { 3212 $this->MyStringField2 = /* HH_FIXME[4110] */ $parsed['MyStringField2']; 3213 } 3214 if (idx($parsed, 'MyBinaryField') !== null) { 3215 $this->MyBinaryField = /* HH_FIXME[4110] */ $parsed['MyBinaryField']; 3216 } 3217 if (idx($parsed, 'MyBinaryField2') !== null) { 3218 $this->MyBinaryField2 = /* HH_FIXME[4110] */ $parsed['MyBinaryField2']; 3219 } 3220 if (idx($parsed, 'MyBinaryField3') !== null) { 3221 $this->MyBinaryField3 = /* HH_FIXME[4110] */ $parsed['MyBinaryField3']; 3222 } else { 3223 throw new \TProtocolException("Required field MyBinaryField3 cannot be found."); 3224 } 3225 if (idx($parsed, 'MyBinaryListField4') !== null) { 3226 $_json3 = /* HH_FIXME[4110] */ $parsed['MyBinaryListField4']; 3227 $_container4 = Vector {}; 3228 foreach(/* HH_FIXME[4110] */ $_json3 as $_key1 => $_value2) { 3229 $_elem5 = ''; 3230 $_elem5 = $_value2; 3231 $_container4 []= $_elem5; 3232 } 3233 $this->MyBinaryListField4 = $_container4; 3234 } 3235 if (idx($parsed, 'MyMapEnumAndInt') !== null) { 3236 $_json9 = /* HH_FIXME[4110] */ $parsed['MyMapEnumAndInt']; 3237 $_container10 = Map {}; 3238 foreach(/* HH_FIXME[4110] */ $_json9 as $_key7 => $_value8) { 3239 $_value11 = ''; 3240 $_value11 = $_value8; 3241 $_container10[$_key7] = $_value11; 3242 } 3243 $this->MyMapEnumAndInt = $_container10; 3244 } 3245 } 3246 3247} 3248 3249enum NoExceptMoveUnionEnum: int { 3250 _EMPTY_ = 0; 3251 string_field = 1; 3252 i32_field = 2; 3253} 3254 3255/** 3256 * Original thrift struct:- 3257 * NoExceptMoveUnion 3258 */ 3259class NoExceptMoveUnion implements \IThriftStruct, \IThriftUnion<NoExceptMoveUnionEnum> { 3260 use \ThriftUnionSerializationTrait; 3261 3262 const dict<int, this::TFieldSpec> SPEC = dict[ 3263 1 => shape( 3264 'var' => 'string_field', 3265 'union' => true, 3266 'type' => \TType::STRING, 3267 ), 3268 2 => shape( 3269 'var' => 'i32_field', 3270 'union' => true, 3271 'type' => \TType::I32, 3272 ), 3273 ]; 3274 const dict<string, int> FIELDMAP = dict[ 3275 'string_field' => 1, 3276 'i32_field' => 2, 3277 ]; 3278 3279 const type TConstructorShape = shape( 3280 ?'string_field' => ?string, 3281 ?'i32_field' => ?int, 3282 ); 3283 3284 const int STRUCTURAL_ID = 5659539827624892912; 3285 /** 3286 * Original thrift field:- 3287 * 1: string string_field 3288 */ 3289 public ?string $string_field; 3290 /** 3291 * Original thrift field:- 3292 * 2: i32 i32_field 3293 */ 3294 public ?int $i32_field; 3295 protected NoExceptMoveUnionEnum $_type = NoExceptMoveUnionEnum::_EMPTY_; 3296 3297 public function __construct(?string $string_field = null, ?int $i32_field = null )[] { 3298 $this->_type = NoExceptMoveUnionEnum::_EMPTY_; 3299 if ($string_field !== null) { 3300 $this->string_field = $string_field; 3301 $this->_type = NoExceptMoveUnionEnum::string_field; 3302 } 3303 if ($i32_field !== null) { 3304 $this->i32_field = $i32_field; 3305 $this->_type = NoExceptMoveUnionEnum::i32_field; 3306 } 3307 } 3308 3309 public static function withDefaultValues()[]: this { 3310 return new static(); 3311 } 3312 3313 public static function fromShape(self::TConstructorShape $shape)[]: this { 3314 return new static( 3315 Shapes::idx($shape, 'string_field'), 3316 Shapes::idx($shape, 'i32_field'), 3317 ); 3318 } 3319 3320 public function getName()[]: string { 3321 return 'NoExceptMoveUnion'; 3322 } 3323 3324 public function getType()[]: NoExceptMoveUnionEnum { 3325 return $this->_type; 3326 } 3327 3328 public function reset()[write_props]: void { 3329 switch ($this->_type) { 3330 case NoExceptMoveUnionEnum::string_field: 3331 $this->string_field = null; 3332 break; 3333 case NoExceptMoveUnionEnum::i32_field: 3334 $this->i32_field = null; 3335 break; 3336 case NoExceptMoveUnionEnum::_EMPTY_: 3337 break; 3338 } 3339 $this->_type = NoExceptMoveUnionEnum::_EMPTY_; 3340 } 3341 3342 public function set_string_field(string $string_field)[write_props]: this { 3343 $this->reset(); 3344 $this->_type = NoExceptMoveUnionEnum::string_field; 3345 $this->string_field = $string_field; 3346 return $this; 3347 } 3348 3349 public function get_string_field()[]: ?string { 3350 return $this->string_field; 3351 } 3352 3353 public function getx_string_field()[]: string { 3354 invariant( 3355 $this->_type === NoExceptMoveUnionEnum::string_field, 3356 'get_string_field called on an instance of NoExceptMoveUnion whose current type is %s', 3357 (string)$this->_type, 3358 ); 3359 return $this->string_field as nonnull; 3360 } 3361 3362 public function set_i32_field(int $i32_field)[write_props]: this { 3363 $this->reset(); 3364 $this->_type = NoExceptMoveUnionEnum::i32_field; 3365 $this->i32_field = $i32_field; 3366 return $this; 3367 } 3368 3369 public function get_i32_field()[]: ?int { 3370 return $this->i32_field; 3371 } 3372 3373 public function getx_i32_field()[]: int { 3374 invariant( 3375 $this->_type === NoExceptMoveUnionEnum::i32_field, 3376 'get_i32_field called on an instance of NoExceptMoveUnion whose current type is %s', 3377 (string)$this->_type, 3378 ); 3379 return $this->i32_field as nonnull; 3380 } 3381 3382 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 3383 return tmeta_ThriftStruct::fromShape( 3384 shape( 3385 "name" => "module.NoExceptMoveUnion", 3386 "fields" => vec[ 3387 tmeta_ThriftField::fromShape( 3388 shape( 3389 "id" => 1, 3390 "type" => tmeta_ThriftType::fromShape( 3391 shape( 3392 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 3393 ) 3394 ), 3395 "name" => "string_field", 3396 ) 3397 ), 3398 tmeta_ThriftField::fromShape( 3399 shape( 3400 "id" => 2, 3401 "type" => tmeta_ThriftType::fromShape( 3402 shape( 3403 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 3404 ) 3405 ), 3406 "name" => "i32_field", 3407 ) 3408 ), 3409 ], 3410 "is_union" => true, 3411 ) 3412 ); 3413 } 3414 3415 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 3416 return shape( 3417 'struct' => dict[], 3418 'fields' => dict[ 3419 ], 3420 ); 3421 } 3422 3423 public function readFromJson(string $jsonText): void { 3424 $this->_type = NoExceptMoveUnionEnum::_EMPTY_; 3425 $parsed = json_decode($jsonText, true); 3426 3427 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 3428 throw new \TProtocolException("Cannot parse the given json string."); 3429 } 3430 3431 if (idx($parsed, 'string_field') !== null) { 3432 $this->string_field = /* HH_FIXME[4110] */ $parsed['string_field']; 3433 $this->_type = NoExceptMoveUnionEnum::string_field; 3434 } 3435 if (idx($parsed, 'i32_field') !== null) { 3436 $_tmp0 = (int)/* HH_FIXME[4110] */ $parsed['i32_field']; 3437 if ($_tmp0 > 0x7fffffff) { 3438 throw new \TProtocolException("number exceeds limit in field"); 3439 } else { 3440 $this->i32_field = (int)$_tmp0; 3441 } 3442 $this->_type = NoExceptMoveUnionEnum::i32_field; 3443 } 3444 } 3445 3446} 3447 3448/** 3449 * Original thrift struct:- 3450 * AllocatorAware 3451 */ 3452class AllocatorAware implements \IThriftStruct { 3453 use \ThriftSerializationTrait; 3454 3455 const dict<int, this::TFieldSpec> SPEC = dict[ 3456 1 => shape( 3457 'var' => 'aa_list', 3458 'type' => \TType::LST, 3459 'etype' => \TType::I32, 3460 'elem' => shape( 3461 'type' => \TType::I32, 3462 ), 3463 'format' => 'collection', 3464 ), 3465 2 => shape( 3466 'var' => 'aa_set', 3467 'type' => \TType::SET, 3468 'etype' => \TType::I32, 3469 'elem' => shape( 3470 'type' => \TType::I32, 3471 ), 3472 'format' => 'collection', 3473 ), 3474 3 => shape( 3475 'var' => 'aa_map', 3476 'type' => \TType::MAP, 3477 'ktype' => \TType::I32, 3478 'vtype' => \TType::I32, 3479 'key' => shape( 3480 'type' => \TType::I32, 3481 ), 3482 'val' => shape( 3483 'type' => \TType::I32, 3484 ), 3485 'format' => 'collection', 3486 ), 3487 4 => shape( 3488 'var' => 'aa_string', 3489 'type' => \TType::STRING, 3490 ), 3491 5 => shape( 3492 'var' => 'not_a_container', 3493 'type' => \TType::I32, 3494 ), 3495 ]; 3496 const dict<string, int> FIELDMAP = dict[ 3497 'aa_list' => 1, 3498 'aa_set' => 2, 3499 'aa_map' => 3, 3500 'aa_string' => 4, 3501 'not_a_container' => 5, 3502 ]; 3503 3504 const type TConstructorShape = shape( 3505 ?'aa_list' => ?Vector<int>, 3506 ?'aa_set' => ?Set<int>, 3507 ?'aa_map' => ?Map<int, int>, 3508 ?'aa_string' => ?string, 3509 ?'not_a_container' => ?int, 3510 ); 3511 3512 const int STRUCTURAL_ID = 5875128050373741032; 3513 /** 3514 * Original thrift field:- 3515 * 1: list<i32> aa_list 3516 */ 3517 public Vector<int> $aa_list; 3518 /** 3519 * Original thrift field:- 3520 * 2: set<i32> aa_set 3521 */ 3522 public Set<int> $aa_set; 3523 /** 3524 * Original thrift field:- 3525 * 3: map<i32, i32> aa_map 3526 */ 3527 public Map<int, int> $aa_map; 3528 /** 3529 * Original thrift field:- 3530 * 4: string aa_string 3531 */ 3532 public string $aa_string; 3533 /** 3534 * Original thrift field:- 3535 * 5: i32 not_a_container 3536 */ 3537 public int $not_a_container; 3538 3539 public function __construct(?Vector<int> $aa_list = null, ?Set<int> $aa_set = null, ?Map<int, int> $aa_map = null, ?string $aa_string = null, ?int $not_a_container = null )[] { 3540 $this->aa_list = $aa_list ?? Vector {}; 3541 $this->aa_set = $aa_set ?? Set {}; 3542 $this->aa_map = $aa_map ?? Map {}; 3543 $this->aa_string = $aa_string ?? ''; 3544 $this->not_a_container = $not_a_container ?? 0; 3545 } 3546 3547 public static function withDefaultValues()[]: this { 3548 return new static(); 3549 } 3550 3551 public static function fromShape(self::TConstructorShape $shape)[]: this { 3552 return new static( 3553 Shapes::idx($shape, 'aa_list'), 3554 Shapes::idx($shape, 'aa_set'), 3555 Shapes::idx($shape, 'aa_map'), 3556 Shapes::idx($shape, 'aa_string'), 3557 Shapes::idx($shape, 'not_a_container'), 3558 ); 3559 } 3560 3561 public function getName()[]: string { 3562 return 'AllocatorAware'; 3563 } 3564 3565 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 3566 return tmeta_ThriftStruct::fromShape( 3567 shape( 3568 "name" => "module.AllocatorAware", 3569 "fields" => vec[ 3570 tmeta_ThriftField::fromShape( 3571 shape( 3572 "id" => 1, 3573 "type" => tmeta_ThriftType::fromShape( 3574 shape( 3575 "t_list" => tmeta_ThriftListType::fromShape( 3576 shape( 3577 "valueType" => tmeta_ThriftType::fromShape( 3578 shape( 3579 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 3580 ) 3581 ), 3582 ) 3583 ), 3584 ) 3585 ), 3586 "name" => "aa_list", 3587 ) 3588 ), 3589 tmeta_ThriftField::fromShape( 3590 shape( 3591 "id" => 2, 3592 "type" => tmeta_ThriftType::fromShape( 3593 shape( 3594 "t_set" => tmeta_ThriftSetType::fromShape( 3595 shape( 3596 "valueType" => tmeta_ThriftType::fromShape( 3597 shape( 3598 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 3599 ) 3600 ), 3601 ) 3602 ), 3603 ) 3604 ), 3605 "name" => "aa_set", 3606 ) 3607 ), 3608 tmeta_ThriftField::fromShape( 3609 shape( 3610 "id" => 3, 3611 "type" => tmeta_ThriftType::fromShape( 3612 shape( 3613 "t_map" => tmeta_ThriftMapType::fromShape( 3614 shape( 3615 "keyType" => tmeta_ThriftType::fromShape( 3616 shape( 3617 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 3618 ) 3619 ), 3620 "valueType" => tmeta_ThriftType::fromShape( 3621 shape( 3622 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 3623 ) 3624 ), 3625 ) 3626 ), 3627 ) 3628 ), 3629 "name" => "aa_map", 3630 ) 3631 ), 3632 tmeta_ThriftField::fromShape( 3633 shape( 3634 "id" => 4, 3635 "type" => tmeta_ThriftType::fromShape( 3636 shape( 3637 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE, 3638 ) 3639 ), 3640 "name" => "aa_string", 3641 ) 3642 ), 3643 tmeta_ThriftField::fromShape( 3644 shape( 3645 "id" => 5, 3646 "type" => tmeta_ThriftType::fromShape( 3647 shape( 3648 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 3649 ) 3650 ), 3651 "name" => "not_a_container", 3652 ) 3653 ), 3654 ], 3655 "is_union" => false, 3656 ) 3657 ); 3658 } 3659 3660 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 3661 return shape( 3662 'struct' => dict[], 3663 'fields' => dict[ 3664 ], 3665 ); 3666 } 3667 3668 public function readFromJson(string $jsonText): void { 3669 $parsed = json_decode($jsonText, true); 3670 3671 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 3672 throw new \TProtocolException("Cannot parse the given json string."); 3673 } 3674 3675 if (idx($parsed, 'aa_list') !== null) { 3676 $_json3 = /* HH_FIXME[4110] */ $parsed['aa_list']; 3677 $_container4 = Vector {}; 3678 foreach(/* HH_FIXME[4110] */ $_json3 as $_key1 => $_value2) { 3679 $_elem5 = 0; 3680 $_tmp6 = (int)$_value2; 3681 if ($_tmp6 > 0x7fffffff) { 3682 throw new \TProtocolException("number exceeds limit in field"); 3683 } else { 3684 $_elem5 = (int)$_tmp6; 3685 } 3686 $_container4 []= $_elem5; 3687 } 3688 $this->aa_list = $_container4; 3689 } 3690 if (idx($parsed, 'aa_set') !== null) { 3691 $_json10 = /* HH_FIXME[4110] */ $parsed['aa_set']; 3692 $_container11 = Set {}; 3693 foreach(/* HH_FIXME[4110] */ $_json10 as $_key8 => $_value9) { 3694 $_elem12 = 0; 3695 $_tmp13 = (int)$_value9; 3696 if ($_tmp13 > 0x7fffffff) { 3697 throw new \TProtocolException("number exceeds limit in field"); 3698 } else { 3699 $_elem12 = (int)$_tmp13; 3700 } 3701 $_container11->add($_elem12); 3702 } 3703 $this->aa_set = $_container11; 3704 } 3705 if (idx($parsed, 'aa_map') !== null) { 3706 $_json17 = /* HH_FIXME[4110] */ $parsed['aa_map']; 3707 $_container18 = Map {}; 3708 foreach(/* HH_FIXME[4110] */ $_json17 as $_key15 => $_value16) { 3709 $_value19 = 0; 3710 $_tmp20 = (int)$_value16; 3711 if ($_tmp20 > 0x7fffffff) { 3712 throw new \TProtocolException("number exceeds limit in field"); 3713 } else { 3714 $_value19 = (int)$_tmp20; 3715 } 3716 $_container18[$_key15] = $_value19; 3717 } 3718 $this->aa_map = $_container18; 3719 } 3720 if (idx($parsed, 'aa_string') !== null) { 3721 $this->aa_string = /* HH_FIXME[4110] */ $parsed['aa_string']; 3722 } 3723 if (idx($parsed, 'not_a_container') !== null) { 3724 $_tmp21 = (int)/* HH_FIXME[4110] */ $parsed['not_a_container']; 3725 if ($_tmp21 > 0x7fffffff) { 3726 throw new \TProtocolException("number exceeds limit in field"); 3727 } else { 3728 $this->not_a_container = (int)$_tmp21; 3729 } 3730 } 3731 } 3732 3733} 3734 3735/** 3736 * Original thrift struct:- 3737 * AllocatorAware2 3738 */ 3739class AllocatorAware2 implements \IThriftStruct { 3740 use \ThriftSerializationTrait; 3741 3742 const dict<int, this::TFieldSpec> SPEC = dict[ 3743 1 => shape( 3744 'var' => 'not_a_container', 3745 'type' => \TType::I32, 3746 ), 3747 ]; 3748 const dict<string, int> FIELDMAP = dict[ 3749 'not_a_container' => 1, 3750 ]; 3751 3752 const type TConstructorShape = shape( 3753 ?'not_a_container' => ?int, 3754 ); 3755 3756 const int STRUCTURAL_ID = 3476753821834683211; 3757 /** 3758 * Original thrift field:- 3759 * 1: i32 not_a_container 3760 */ 3761 public int $not_a_container; 3762 3763 public function __construct(?int $not_a_container = null )[] { 3764 $this->not_a_container = $not_a_container ?? 0; 3765 } 3766 3767 public static function withDefaultValues()[]: this { 3768 return new static(); 3769 } 3770 3771 public static function fromShape(self::TConstructorShape $shape)[]: this { 3772 return new static( 3773 Shapes::idx($shape, 'not_a_container'), 3774 ); 3775 } 3776 3777 public function getName()[]: string { 3778 return 'AllocatorAware2'; 3779 } 3780 3781 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 3782 return tmeta_ThriftStruct::fromShape( 3783 shape( 3784 "name" => "module.AllocatorAware2", 3785 "fields" => vec[ 3786 tmeta_ThriftField::fromShape( 3787 shape( 3788 "id" => 1, 3789 "type" => tmeta_ThriftType::fromShape( 3790 shape( 3791 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 3792 ) 3793 ), 3794 "name" => "not_a_container", 3795 ) 3796 ), 3797 ], 3798 "is_union" => false, 3799 ) 3800 ); 3801 } 3802 3803 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 3804 return shape( 3805 'struct' => dict[], 3806 'fields' => dict[ 3807 ], 3808 ); 3809 } 3810 3811 public function readFromJson(string $jsonText): void { 3812 $parsed = json_decode($jsonText, true); 3813 3814 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 3815 throw new \TProtocolException("Cannot parse the given json string."); 3816 } 3817 3818 if (idx($parsed, 'not_a_container') !== null) { 3819 $_tmp0 = (int)/* HH_FIXME[4110] */ $parsed['not_a_container']; 3820 if ($_tmp0 > 0x7fffffff) { 3821 throw new \TProtocolException("number exceeds limit in field"); 3822 } else { 3823 $this->not_a_container = (int)$_tmp0; 3824 } 3825 } 3826 } 3827 3828} 3829 3830/** 3831 * Original thrift struct:- 3832 * TypedefStruct 3833 */ 3834class TypedefStruct implements \IThriftStruct { 3835 use \ThriftSerializationTrait; 3836 3837 const dict<int, this::TFieldSpec> SPEC = dict[ 3838 1 => shape( 3839 'var' => 'i32_field', 3840 'type' => \TType::I32, 3841 ), 3842 2 => shape( 3843 'var' => 'IntTypedef_field', 3844 'type' => \TType::I32, 3845 ), 3846 3 => shape( 3847 'var' => 'UintTypedef_field', 3848 'type' => \TType::I32, 3849 ), 3850 ]; 3851 const dict<string, int> FIELDMAP = dict[ 3852 'i32_field' => 1, 3853 'IntTypedef_field' => 2, 3854 'UintTypedef_field' => 3, 3855 ]; 3856 3857 const type TConstructorShape = shape( 3858 ?'i32_field' => ?int, 3859 ?'IntTypedef_field' => ?int, 3860 ?'UintTypedef_field' => ?int, 3861 ); 3862 3863 const int STRUCTURAL_ID = 9104074718450007174; 3864 /** 3865 * Original thrift field:- 3866 * 1: i32 i32_field 3867 */ 3868 public int $i32_field; 3869 /** 3870 * Original thrift field:- 3871 * 2: i32 IntTypedef_field 3872 */ 3873 public int $IntTypedef_field; 3874 /** 3875 * Original thrift field:- 3876 * 3: i32 UintTypedef_field 3877 */ 3878 public int $UintTypedef_field; 3879 3880 public function __construct(?int $i32_field = null, ?int $IntTypedef_field = null, ?int $UintTypedef_field = null )[] { 3881 $this->i32_field = $i32_field ?? 0; 3882 $this->IntTypedef_field = $IntTypedef_field ?? 0; 3883 $this->UintTypedef_field = $UintTypedef_field ?? 0; 3884 } 3885 3886 public static function withDefaultValues()[]: this { 3887 return new static(); 3888 } 3889 3890 public static function fromShape(self::TConstructorShape $shape)[]: this { 3891 return new static( 3892 Shapes::idx($shape, 'i32_field'), 3893 Shapes::idx($shape, 'IntTypedef_field'), 3894 Shapes::idx($shape, 'UintTypedef_field'), 3895 ); 3896 } 3897 3898 public function getName()[]: string { 3899 return 'TypedefStruct'; 3900 } 3901 3902 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 3903 return tmeta_ThriftStruct::fromShape( 3904 shape( 3905 "name" => "module.TypedefStruct", 3906 "fields" => vec[ 3907 tmeta_ThriftField::fromShape( 3908 shape( 3909 "id" => 1, 3910 "type" => tmeta_ThriftType::fromShape( 3911 shape( 3912 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 3913 ) 3914 ), 3915 "name" => "i32_field", 3916 ) 3917 ), 3918 tmeta_ThriftField::fromShape( 3919 shape( 3920 "id" => 2, 3921 "type" => tmeta_ThriftType::fromShape( 3922 shape( 3923 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 3924 shape( 3925 "name" => "module.IntTypedef", 3926 "underlyingType" => tmeta_ThriftType::fromShape( 3927 shape( 3928 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 3929 ) 3930 ), 3931 ) 3932 ), 3933 ) 3934 ), 3935 "name" => "IntTypedef_field", 3936 ) 3937 ), 3938 tmeta_ThriftField::fromShape( 3939 shape( 3940 "id" => 3, 3941 "type" => tmeta_ThriftType::fromShape( 3942 shape( 3943 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 3944 shape( 3945 "name" => "module.UintTypedef", 3946 "underlyingType" => tmeta_ThriftType::fromShape( 3947 shape( 3948 "t_typedef" => tmeta_ThriftTypedefType::fromShape( 3949 shape( 3950 "name" => "module.IntTypedef", 3951 "underlyingType" => tmeta_ThriftType::fromShape( 3952 shape( 3953 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 3954 ) 3955 ), 3956 ) 3957 ), 3958 ) 3959 ), 3960 ) 3961 ), 3962 ) 3963 ), 3964 "name" => "UintTypedef_field", 3965 ) 3966 ), 3967 ], 3968 "is_union" => false, 3969 ) 3970 ); 3971 } 3972 3973 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 3974 return shape( 3975 'struct' => dict[], 3976 'fields' => dict[ 3977 ], 3978 ); 3979 } 3980 3981 public function readFromJson(string $jsonText): void { 3982 $parsed = json_decode($jsonText, true); 3983 3984 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 3985 throw new \TProtocolException("Cannot parse the given json string."); 3986 } 3987 3988 if (idx($parsed, 'i32_field') !== null) { 3989 $_tmp0 = (int)/* HH_FIXME[4110] */ $parsed['i32_field']; 3990 if ($_tmp0 > 0x7fffffff) { 3991 throw new \TProtocolException("number exceeds limit in field"); 3992 } else { 3993 $this->i32_field = (int)$_tmp0; 3994 } 3995 } 3996 if (idx($parsed, 'IntTypedef_field') !== null) { 3997 $_tmp1 = (int)/* HH_FIXME[4110] */ $parsed['IntTypedef_field']; 3998 if ($_tmp1 > 0x7fffffff) { 3999 throw new \TProtocolException("number exceeds limit in field"); 4000 } else { 4001 $this->IntTypedef_field = (int)$_tmp1; 4002 } 4003 } 4004 if (idx($parsed, 'UintTypedef_field') !== null) { 4005 $_tmp2 = (int)/* HH_FIXME[4110] */ $parsed['UintTypedef_field']; 4006 if ($_tmp2 > 0x7fffffff) { 4007 throw new \TProtocolException("number exceeds limit in field"); 4008 } else { 4009 $this->UintTypedef_field = (int)$_tmp2; 4010 } 4011 } 4012 } 4013 4014} 4015 4016/** 4017 * Original thrift struct:- 4018 * StructWithDoubleUnderscores 4019 */ 4020class StructWithDoubleUnderscores implements \IThriftStruct { 4021 use \ThriftSerializationTrait; 4022 4023 const dict<int, this::TFieldSpec> SPEC = dict[ 4024 1 => shape( 4025 'var' => '__field', 4026 'type' => \TType::I32, 4027 ), 4028 ]; 4029 const dict<string, int> FIELDMAP = dict[ 4030 '__field' => 1, 4031 ]; 4032 4033 const type TConstructorShape = shape( 4034 ?'__field' => ?int, 4035 ); 4036 4037 const int STRUCTURAL_ID = 8209484534723602012; 4038 /** 4039 * Original thrift field:- 4040 * 1: i32 __field 4041 */ 4042 public int $__field; 4043 4044 public function __construct(?int $__field = null )[] { 4045 $this->__field = $__field ?? 0; 4046 } 4047 4048 public static function withDefaultValues()[]: this { 4049 return new static(); 4050 } 4051 4052 public static function fromShape(self::TConstructorShape $shape)[]: this { 4053 return new static( 4054 Shapes::idx($shape, '__field'), 4055 ); 4056 } 4057 4058 public function getName()[]: string { 4059 return 'StructWithDoubleUnderscores'; 4060 } 4061 4062 public static function getStructMetadata()[]: \tmeta_ThriftStruct { 4063 return tmeta_ThriftStruct::fromShape( 4064 shape( 4065 "name" => "module.StructWithDoubleUnderscores", 4066 "fields" => vec[ 4067 tmeta_ThriftField::fromShape( 4068 shape( 4069 "id" => 1, 4070 "type" => tmeta_ThriftType::fromShape( 4071 shape( 4072 "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE, 4073 ) 4074 ), 4075 "name" => "__field", 4076 ) 4077 ), 4078 ], 4079 "is_union" => false, 4080 ) 4081 ); 4082 } 4083 4084 public static function getAllStructuredAnnotations()[]: \TStructAnnotations { 4085 return shape( 4086 'struct' => dict[], 4087 'fields' => dict[ 4088 ], 4089 ); 4090 } 4091 4092 public function readFromJson(string $jsonText): void { 4093 $parsed = json_decode($jsonText, true); 4094 4095 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) { 4096 throw new \TProtocolException("Cannot parse the given json string."); 4097 } 4098 4099 if (idx($parsed, '__field') !== null) { 4100 $_tmp0 = (int)/* HH_FIXME[4110] */ $parsed['__field']; 4101 if ($_tmp0 > 0x7fffffff) { 4102 throw new \TProtocolException("number exceeds limit in field"); 4103 } else { 4104 $this->__field = (int)$_tmp0; 4105 } 4106 } 4107 } 4108 4109} 4110 4111