Re-sync with internal repository
[hiphop-php.git] / third-party / thrift / src / thrift / compiler / test / fixtures / hack_field_wrapper_with_arrays / gen-hack / hack_types.php
blob2835ef23823cd131ca47277bc7571d6679ddb81b
1 <?hh
2 /**
3 * Autogenerated by Thrift
5 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
6 * @generated
7 */
9 namespace thrift\annotation\hack;
11 /**
12 * Original thrift struct:-
13 * FieldWrapper
15 <<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/hack/FieldWrapper'))>>
16 class FieldWrapper implements \IThriftSyncStruct, \IThriftShapishSyncStruct {
17 use \ThriftSerializationTrait;
19 const dict<int, this::TFieldSpec> SPEC = dict[
20 1 => shape(
21 'var' => 'name',
22 'type' => \TType::STRING,
25 const dict<string, int> FIELDMAP = dict[
26 'name' => 1,
29 const type TConstructorShape = shape(
30 ?'name' => ?string,
33 const type TShape = shape(
34 'name' => string,
36 const int STRUCTURAL_ID = 2593878277785201336;
37 /**
38 * Original thrift field:-
39 * 1: string name
41 public string $name;
43 public function __construct(?string $name = null)[] {
44 $this->name = $name ?? '';
47 public static function withDefaultValues()[]: this {
48 return new static();
51 public static function fromShape(self::TConstructorShape $shape)[]: this {
52 return new static(
53 Shapes::idx($shape, 'name'),
57 public static function fromMap_DEPRECATED(@KeyedContainer<string, mixed> $map)[]: this {
58 return new static(
59 HH\FIXME\UNSAFE_CAST<mixed, string>(idx($map, 'name'), 'map value is mixed'),
63 public function getName()[]: string {
64 return 'FieldWrapper';
67 public static function getStructMetadata()[]: \tmeta_ThriftStruct {
68 return \tmeta_ThriftStruct::fromShape(
69 shape(
70 "name" => "hack.FieldWrapper",
71 "fields" => vec[
72 \tmeta_ThriftField::fromShape(
73 shape(
74 "id" => 1,
75 "type" => \tmeta_ThriftType::fromShape(
76 shape(
77 "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
80 "name" => "name",
84 "is_union" => false,
89 public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
90 return shape(
91 'struct' => dict[
92 '\thrift\annotation\Field' => \thrift\annotation\Field::fromShape(
93 shape(
97 'fields' => dict[
102 public static function __stringifyMapKeys<T>(dict<arraykey, T> $m)[]: dict<string, T> {
103 return Dict\map_keys($m, $key ==> (string)$key);
106 public static function __fromShape(self::TShape $shape)[]: this {
107 return new static(
108 $shape['name'],
112 public function __toShape()[]: self::TShape {
113 return shape(
114 'name' => $this->name,
117 public function getInstanceKey()[write_props]: string {
118 return \TCompactSerializer::serialize($this);
121 public function readFromJson(string $jsonText): void {
122 $parsed = json_decode($jsonText, true);
124 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
125 throw new \TProtocolException("Cannot parse the given json string.");
128 if (idx($parsed, 'name') !== null) {
129 $this->name = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['name']);
136 * Original thrift struct:-
137 * Wrapper
139 <<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/hack/Wrapper'))>>
140 class Wrapper implements \IThriftSyncStruct, \IThriftShapishSyncStruct {
141 use \ThriftSerializationTrait;
143 const dict<int, this::TFieldSpec> SPEC = dict[
144 1 => shape(
145 'var' => 'name',
146 'type' => \TType::STRING,
148 2 => shape(
149 'var' => 'underlyingName',
150 'type' => \TType::STRING,
152 3 => shape(
153 'var' => 'extraNamespace',
154 'type' => \TType::STRING,
157 const dict<string, int> FIELDMAP = dict[
158 'name' => 1,
159 'underlyingName' => 2,
160 'extraNamespace' => 3,
163 const type TConstructorShape = shape(
164 ?'name' => ?string,
165 ?'underlyingName' => ?string,
166 ?'extraNamespace' => ?string,
169 const type TShape = shape(
170 'name' => string,
171 'underlyingName' => string,
172 'extraNamespace' => string,
174 const int STRUCTURAL_ID = 1284986773698322040;
176 * Original thrift field:-
177 * 1: string name
179 public string $name;
181 * Original thrift field:-
182 * 2: string underlyingName
184 public string $underlyingName;
186 * Original thrift field:-
187 * 3: string extraNamespace
189 public string $extraNamespace;
191 public function __construct(?string $name = null, ?string $underlyingName = null, ?string $extraNamespace = null)[] {
192 $this->name = $name ?? '';
193 $this->underlyingName = $underlyingName ?? '';
194 $this->extraNamespace = $extraNamespace ?? "thrift_adapted_types";
197 public static function withDefaultValues()[]: this {
198 return new static();
201 public static function fromShape(self::TConstructorShape $shape)[]: this {
202 return new static(
203 Shapes::idx($shape, 'name'),
204 Shapes::idx($shape, 'underlyingName'),
205 Shapes::idx($shape, 'extraNamespace'),
209 public static function fromMap_DEPRECATED(@KeyedContainer<string, mixed> $map)[]: this {
210 return new static(
211 HH\FIXME\UNSAFE_CAST<mixed, string>(idx($map, 'name'), 'map value is mixed'),
212 HH\FIXME\UNSAFE_CAST<mixed, string>(idx($map, 'underlyingName'), 'map value is mixed'),
213 HH\FIXME\UNSAFE_CAST<mixed, string>(idx($map, 'extraNamespace'), 'map value is mixed'),
217 public function getName()[]: string {
218 return 'Wrapper';
221 public static function getStructMetadata()[]: \tmeta_ThriftStruct {
222 return \tmeta_ThriftStruct::fromShape(
223 shape(
224 "name" => "hack.Wrapper",
225 "fields" => vec[
226 \tmeta_ThriftField::fromShape(
227 shape(
228 "id" => 1,
229 "type" => \tmeta_ThriftType::fromShape(
230 shape(
231 "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
234 "name" => "name",
237 \tmeta_ThriftField::fromShape(
238 shape(
239 "id" => 2,
240 "type" => \tmeta_ThriftType::fromShape(
241 shape(
242 "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
245 "name" => "underlyingName",
248 \tmeta_ThriftField::fromShape(
249 shape(
250 "id" => 3,
251 "type" => \tmeta_ThriftType::fromShape(
252 shape(
253 "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
256 "name" => "extraNamespace",
260 "is_union" => false,
265 public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
266 return shape(
267 'struct' => dict[
268 '\thrift\annotation\Typedef' => \thrift\annotation\Typedef::fromShape(
269 shape(
272 '\thrift\annotation\Struct' => \thrift\annotation\Struct::fromShape(
273 shape(
276 '\thrift\annotation\Field' => \thrift\annotation\Field::fromShape(
277 shape(
281 'fields' => dict[
286 public static function __stringifyMapKeys<T>(dict<arraykey, T> $m)[]: dict<string, T> {
287 return Dict\map_keys($m, $key ==> (string)$key);
290 public static function __fromShape(self::TShape $shape)[]: this {
291 return new static(
292 $shape['name'],
293 $shape['underlyingName'],
294 $shape['extraNamespace'],
298 public function __toShape()[]: self::TShape {
299 return shape(
300 'name' => $this->name,
301 'underlyingName' => $this->underlyingName,
302 'extraNamespace' => $this->extraNamespace,
305 public function getInstanceKey()[write_props]: string {
306 return \TCompactSerializer::serialize($this);
309 public function readFromJson(string $jsonText): void {
310 $parsed = json_decode($jsonText, true);
312 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
313 throw new \TProtocolException("Cannot parse the given json string.");
316 if (idx($parsed, 'name') !== null) {
317 $this->name = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['name']);
319 if (idx($parsed, 'underlyingName') !== null) {
320 $this->underlyingName = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['underlyingName']);
322 if (idx($parsed, 'extraNamespace') !== null) {
323 $this->extraNamespace = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['extraNamespace']);
330 * Original thrift struct:-
331 * Adapter
333 <<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/hack/Adapter'))>>
334 class Adapter implements \IThriftSyncStruct, \IThriftShapishSyncStruct {
335 use \ThriftSerializationTrait;
337 const dict<int, this::TFieldSpec> SPEC = dict[
338 1 => shape(
339 'var' => 'name',
340 'type' => \TType::STRING,
343 const dict<string, int> FIELDMAP = dict[
344 'name' => 1,
347 const type TConstructorShape = shape(
348 ?'name' => ?string,
351 const type TShape = shape(
352 'name' => string,
354 const int STRUCTURAL_ID = 2593878277785201336;
356 * Original thrift field:-
357 * 1: string name
359 public string $name;
361 public function __construct(?string $name = null)[] {
362 $this->name = $name ?? '';
365 public static function withDefaultValues()[]: this {
366 return new static();
369 public static function fromShape(self::TConstructorShape $shape)[]: this {
370 return new static(
371 Shapes::idx($shape, 'name'),
375 public static function fromMap_DEPRECATED(@KeyedContainer<string, mixed> $map)[]: this {
376 return new static(
377 HH\FIXME\UNSAFE_CAST<mixed, string>(idx($map, 'name'), 'map value is mixed'),
381 public function getName()[]: string {
382 return 'Adapter';
385 public static function getStructMetadata()[]: \tmeta_ThriftStruct {
386 return \tmeta_ThriftStruct::fromShape(
387 shape(
388 "name" => "hack.Adapter",
389 "fields" => vec[
390 \tmeta_ThriftField::fromShape(
391 shape(
392 "id" => 1,
393 "type" => \tmeta_ThriftType::fromShape(
394 shape(
395 "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
398 "name" => "name",
402 "is_union" => false,
407 public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
408 return shape(
409 'struct' => dict[
410 '\thrift\annotation\Typedef' => \thrift\annotation\Typedef::fromShape(
411 shape(
414 '\thrift\annotation\Field' => \thrift\annotation\Field::fromShape(
415 shape(
419 'fields' => dict[
424 public static function __stringifyMapKeys<T>(dict<arraykey, T> $m)[]: dict<string, T> {
425 return Dict\map_keys($m, $key ==> (string)$key);
428 public static function __fromShape(self::TShape $shape)[]: this {
429 return new static(
430 $shape['name'],
434 public function __toShape()[]: self::TShape {
435 return shape(
436 'name' => $this->name,
439 public function getInstanceKey()[write_props]: string {
440 return \TCompactSerializer::serialize($this);
443 public function readFromJson(string $jsonText): void {
444 $parsed = json_decode($jsonText, true);
446 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
447 throw new \TProtocolException("Cannot parse the given json string.");
450 if (idx($parsed, 'name') !== null) {
451 $this->name = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['name']);
458 * Original thrift struct:-
459 * SkipCodegen
461 <<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/hack/SkipCodegen'))>>
462 class SkipCodegen implements \IThriftSyncStruct, \IThriftShapishSyncStruct {
463 use \ThriftSerializationTrait;
465 const dict<int, this::TFieldSpec> SPEC = dict[
466 1 => shape(
467 'var' => 'reason',
468 'type' => \TType::STRING,
471 const dict<string, int> FIELDMAP = dict[
472 'reason' => 1,
475 const type TConstructorShape = shape(
476 ?'reason' => ?string,
479 const type TShape = shape(
480 'reason' => string,
482 const int STRUCTURAL_ID = 3707764047816594739;
484 * Original thrift field:-
485 * 1: string reason
487 public string $reason;
489 public function __construct(?string $reason = null)[] {
490 $this->reason = $reason ?? '';
493 public static function withDefaultValues()[]: this {
494 return new static();
497 public static function fromShape(self::TConstructorShape $shape)[]: this {
498 return new static(
499 Shapes::idx($shape, 'reason'),
503 public static function fromMap_DEPRECATED(@KeyedContainer<string, mixed> $map)[]: this {
504 return new static(
505 HH\FIXME\UNSAFE_CAST<mixed, string>(idx($map, 'reason'), 'map value is mixed'),
509 public function getName()[]: string {
510 return 'SkipCodegen';
513 public static function getStructMetadata()[]: \tmeta_ThriftStruct {
514 return \tmeta_ThriftStruct::fromShape(
515 shape(
516 "name" => "hack.SkipCodegen",
517 "fields" => vec[
518 \tmeta_ThriftField::fromShape(
519 shape(
520 "id" => 1,
521 "type" => \tmeta_ThriftType::fromShape(
522 shape(
523 "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
526 "name" => "reason",
530 "is_union" => false,
535 public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
536 return shape(
537 'struct' => dict[
538 '\thrift\annotation\Field' => \thrift\annotation\Field::fromShape(
539 shape(
542 '\thrift\annotation\TFunction' => \thrift\annotation\TFunction::fromShape(
543 shape(
547 'fields' => dict[
552 public static function __stringifyMapKeys<T>(dict<arraykey, T> $m)[]: dict<string, T> {
553 return Dict\map_keys($m, $key ==> (string)$key);
556 public static function __fromShape(self::TShape $shape)[]: this {
557 return new static(
558 $shape['reason'],
562 public function __toShape()[]: self::TShape {
563 return shape(
564 'reason' => $this->reason,
567 public function getInstanceKey()[write_props]: string {
568 return \TCompactSerializer::serialize($this);
571 public function readFromJson(string $jsonText): void {
572 $parsed = json_decode($jsonText, true);
574 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
575 throw new \TProtocolException("Cannot parse the given json string.");
578 if (idx($parsed, 'reason') !== null) {
579 $this->reason = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['reason']);
586 * Original thrift struct:-
587 * Name
589 <<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/hack/Name'))>>
590 class Name implements \IThriftSyncStruct, \IThriftShapishSyncStruct {
591 use \ThriftSerializationTrait;
593 const dict<int, this::TFieldSpec> SPEC = dict[
594 1 => shape(
595 'var' => 'name',
596 'type' => \TType::STRING,
598 2 => shape(
599 'var' => 'reason',
600 'type' => \TType::STRING,
603 const dict<string, int> FIELDMAP = dict[
604 'name' => 1,
605 'reason' => 2,
608 const type TConstructorShape = shape(
609 ?'name' => ?string,
610 ?'reason' => ?string,
613 const type TShape = shape(
614 'name' => string,
615 'reason' => string,
617 const int STRUCTURAL_ID = 4844827548325959202;
619 * Original thrift field:-
620 * 1: string name
622 public string $name;
624 * Original thrift field:-
625 * 2: string reason
627 public string $reason;
629 public function __construct(?string $name = null, ?string $reason = null)[] {
630 $this->name = $name ?? '';
631 $this->reason = $reason ?? '';
634 public static function withDefaultValues()[]: this {
635 return new static();
638 public static function fromShape(self::TConstructorShape $shape)[]: this {
639 return new static(
640 Shapes::idx($shape, 'name'),
641 Shapes::idx($shape, 'reason'),
645 public static function fromMap_DEPRECATED(@KeyedContainer<string, mixed> $map)[]: this {
646 return new static(
647 HH\FIXME\UNSAFE_CAST<mixed, string>(idx($map, 'name'), 'map value is mixed'),
648 HH\FIXME\UNSAFE_CAST<mixed, string>(idx($map, 'reason'), 'map value is mixed'),
652 public function getName()[]: string {
653 return 'Name';
656 public static function getStructMetadata()[]: \tmeta_ThriftStruct {
657 return \tmeta_ThriftStruct::fromShape(
658 shape(
659 "name" => "hack.Name",
660 "fields" => vec[
661 \tmeta_ThriftField::fromShape(
662 shape(
663 "id" => 1,
664 "type" => \tmeta_ThriftType::fromShape(
665 shape(
666 "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
669 "name" => "name",
672 \tmeta_ThriftField::fromShape(
673 shape(
674 "id" => 2,
675 "type" => \tmeta_ThriftType::fromShape(
676 shape(
677 "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
680 "name" => "reason",
684 "is_union" => false,
689 public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
690 return shape(
691 'struct' => dict[],
692 'fields' => dict[
697 public static function __stringifyMapKeys<T>(dict<arraykey, T> $m)[]: dict<string, T> {
698 return Dict\map_keys($m, $key ==> (string)$key);
701 public static function __fromShape(self::TShape $shape)[]: this {
702 return new static(
703 $shape['name'],
704 $shape['reason'],
708 public function __toShape()[]: self::TShape {
709 return shape(
710 'name' => $this->name,
711 'reason' => $this->reason,
714 public function getInstanceKey()[write_props]: string {
715 return \TCompactSerializer::serialize($this);
718 public function readFromJson(string $jsonText): void {
719 $parsed = json_decode($jsonText, true);
721 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
722 throw new \TProtocolException("Cannot parse the given json string.");
725 if (idx($parsed, 'name') !== null) {
726 $this->name = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['name']);
728 if (idx($parsed, 'reason') !== null) {
729 $this->reason = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['reason']);
736 * Original thrift struct:-
737 * UnionEnumAttributes
739 <<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/hack/UnionEnumAttributes'))>>
740 class UnionEnumAttributes implements \IThriftSyncStruct, \IThriftShapishSyncStruct {
741 use \ThriftSerializationTrait;
743 const dict<int, this::TFieldSpec> SPEC = dict[
744 1 => shape(
745 'var' => 'attributes',
746 'type' => \TType::LST,
747 'etype' => \TType::STRING,
748 'elem' => shape(
749 'type' => \TType::STRING,
751 'format' => 'harray',
754 const dict<string, int> FIELDMAP = dict[
755 'attributes' => 1,
758 const type TConstructorShape = shape(
759 ?'attributes' => ?vec<string>,
762 const type TShape = shape(
763 'attributes' => vec<string>,
765 const int STRUCTURAL_ID = 4379867690114498379;
767 * Original thrift field:-
768 * 1: list<string> attributes
770 public vec<string> $attributes;
772 public function __construct(?vec<string> $attributes = null)[] {
773 $this->attributes = $attributes ?? vec[];
776 public static function withDefaultValues()[]: this {
777 return new static();
780 public static function fromShape(self::TConstructorShape $shape)[]: this {
781 return new static(
782 Shapes::idx($shape, 'attributes'),
786 public static function fromMap_DEPRECATED(@KeyedContainer<string, mixed> $map)[]: this {
787 return new static(
788 HH\FIXME\UNSAFE_CAST<mixed, vec<string>>(idx($map, 'attributes'), 'map value is mixed'),
792 public function getName()[]: string {
793 return 'UnionEnumAttributes';
796 public static function getStructMetadata()[]: \tmeta_ThriftStruct {
797 return \tmeta_ThriftStruct::fromShape(
798 shape(
799 "name" => "hack.UnionEnumAttributes",
800 "fields" => vec[
801 \tmeta_ThriftField::fromShape(
802 shape(
803 "id" => 1,
804 "type" => \tmeta_ThriftType::fromShape(
805 shape(
806 "t_list" => \tmeta_ThriftListType::fromShape(
807 shape(
808 "valueType" => \tmeta_ThriftType::fromShape(
809 shape(
810 "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
817 "name" => "attributes",
821 "is_union" => false,
826 public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
827 return shape(
828 'struct' => dict[
829 '\thrift\annotation\Union' => \thrift\annotation\Union::fromShape(
830 shape(
834 'fields' => dict[
839 public static function __stringifyMapKeys<T>(dict<arraykey, T> $m)[]: dict<string, T> {
840 return Dict\map_keys($m, $key ==> (string)$key);
843 public static function __fromShape(self::TShape $shape)[]: this {
844 return new static(
845 $shape['attributes'],
849 public function __toShape()[]: self::TShape {
850 return shape(
851 'attributes' => $this->attributes,
854 public function getInstanceKey()[write_props]: string {
855 return \TCompactSerializer::serialize($this);
858 public function readFromJson(string $jsonText): void {
859 $parsed = json_decode($jsonText, true);
861 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
862 throw new \TProtocolException("Cannot parse the given json string.");
865 if (idx($parsed, 'attributes') !== null) {
866 $_json3 = HH\FIXME\UNSAFE_CAST<mixed, vec<string>>($parsed['attributes']);
867 $_container4 = vec[];
868 foreach($_json3 as $_key1 => $_value2) {
869 $_elem5 = '';
870 $_elem5 = $_value2;
871 $_container4 []= $_elem5;
873 $this->attributes = $_container4;
880 * Original thrift struct:-
881 * StructTrait
883 <<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/hack/StructTrait'))>>
884 class StructTrait implements \IThriftSyncStruct, \IThriftShapishSyncStruct {
885 use \ThriftSerializationTrait;
887 const dict<int, this::TFieldSpec> SPEC = dict[
888 1 => shape(
889 'var' => 'name',
890 'type' => \TType::STRING,
893 const dict<string, int> FIELDMAP = dict[
894 'name' => 1,
897 const type TConstructorShape = shape(
898 ?'name' => ?string,
901 const type TShape = shape(
902 'name' => string,
904 const int STRUCTURAL_ID = 2593878277785201336;
906 * Original thrift field:-
907 * 1: string name
909 public string $name;
911 public function __construct(?string $name = null)[] {
912 $this->name = $name ?? '';
915 public static function withDefaultValues()[]: this {
916 return new static();
919 public static function fromShape(self::TConstructorShape $shape)[]: this {
920 return new static(
921 Shapes::idx($shape, 'name'),
925 public static function fromMap_DEPRECATED(@KeyedContainer<string, mixed> $map)[]: this {
926 return new static(
927 HH\FIXME\UNSAFE_CAST<mixed, string>(idx($map, 'name'), 'map value is mixed'),
931 public function getName()[]: string {
932 return 'StructTrait';
935 public static function getStructMetadata()[]: \tmeta_ThriftStruct {
936 return \tmeta_ThriftStruct::fromShape(
937 shape(
938 "name" => "hack.StructTrait",
939 "fields" => vec[
940 \tmeta_ThriftField::fromShape(
941 shape(
942 "id" => 1,
943 "type" => \tmeta_ThriftType::fromShape(
944 shape(
945 "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
948 "name" => "name",
952 "is_union" => false,
957 public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
958 return shape(
959 'struct' => dict[
960 '\thrift\annotation\Struct' => \thrift\annotation\Struct::fromShape(
961 shape(
965 'fields' => dict[
970 public static function __stringifyMapKeys<T>(dict<arraykey, T> $m)[]: dict<string, T> {
971 return Dict\map_keys($m, $key ==> (string)$key);
974 public static function __fromShape(self::TShape $shape)[]: this {
975 return new static(
976 $shape['name'],
980 public function __toShape()[]: self::TShape {
981 return shape(
982 'name' => $this->name,
985 public function getInstanceKey()[write_props]: string {
986 return \TCompactSerializer::serialize($this);
989 public function readFromJson(string $jsonText): void {
990 $parsed = json_decode($jsonText, true);
992 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
993 throw new \TProtocolException("Cannot parse the given json string.");
996 if (idx($parsed, 'name') !== null) {
997 $this->name = HH\FIXME\UNSAFE_CAST<mixed, string>($parsed['name']);
1004 * Original thrift struct:-
1005 * Attributes
1007 <<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/hack/Attributes'))>>
1008 class Attributes implements \IThriftSyncStruct, \IThriftShapishSyncStruct {
1009 use \ThriftSerializationTrait;
1011 const dict<int, this::TFieldSpec> SPEC = dict[
1012 1 => shape(
1013 'var' => 'attributes',
1014 'type' => \TType::LST,
1015 'etype' => \TType::STRING,
1016 'elem' => shape(
1017 'type' => \TType::STRING,
1019 'format' => 'harray',
1022 const dict<string, int> FIELDMAP = dict[
1023 'attributes' => 1,
1026 const type TConstructorShape = shape(
1027 ?'attributes' => ?vec<string>,
1030 const type TShape = shape(
1031 'attributes' => vec<string>,
1033 const int STRUCTURAL_ID = 4379867690114498379;
1035 * Original thrift field:-
1036 * 1: list<string> attributes
1038 public vec<string> $attributes;
1040 public function __construct(?vec<string> $attributes = null)[] {
1041 $this->attributes = $attributes ?? vec[];
1044 public static function withDefaultValues()[]: this {
1045 return new static();
1048 public static function fromShape(self::TConstructorShape $shape)[]: this {
1049 return new static(
1050 Shapes::idx($shape, 'attributes'),
1054 public static function fromMap_DEPRECATED(@KeyedContainer<string, mixed> $map)[]: this {
1055 return new static(
1056 HH\FIXME\UNSAFE_CAST<mixed, vec<string>>(idx($map, 'attributes'), 'map value is mixed'),
1060 public function getName()[]: string {
1061 return 'Attributes';
1064 public static function getStructMetadata()[]: \tmeta_ThriftStruct {
1065 return \tmeta_ThriftStruct::fromShape(
1066 shape(
1067 "name" => "hack.Attributes",
1068 "fields" => vec[
1069 \tmeta_ThriftField::fromShape(
1070 shape(
1071 "id" => 1,
1072 "type" => \tmeta_ThriftType::fromShape(
1073 shape(
1074 "t_list" => \tmeta_ThriftListType::fromShape(
1075 shape(
1076 "valueType" => \tmeta_ThriftType::fromShape(
1077 shape(
1078 "t_primitive" => \tmeta_ThriftPrimitiveType::THRIFT_STRING_TYPE,
1085 "name" => "attributes",
1089 "is_union" => false,
1094 public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
1095 return shape(
1096 'struct' => dict[],
1097 'fields' => dict[
1102 public static function __stringifyMapKeys<T>(dict<arraykey, T> $m)[]: dict<string, T> {
1103 return Dict\map_keys($m, $key ==> (string)$key);
1106 public static function __fromShape(self::TShape $shape)[]: this {
1107 return new static(
1108 $shape['attributes'],
1112 public function __toShape()[]: self::TShape {
1113 return shape(
1114 'attributes' => $this->attributes,
1117 public function getInstanceKey()[write_props]: string {
1118 return \TCompactSerializer::serialize($this);
1121 public function readFromJson(string $jsonText): void {
1122 $parsed = json_decode($jsonText, true);
1124 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
1125 throw new \TProtocolException("Cannot parse the given json string.");
1128 if (idx($parsed, 'attributes') !== null) {
1129 $_json3 = HH\FIXME\UNSAFE_CAST<mixed, vec<string>>($parsed['attributes']);
1130 $_container4 = vec[];
1131 foreach($_json3 as $_key1 => $_value2) {
1132 $_elem5 = '';
1133 $_elem5 = $_value2;
1134 $_container4 []= $_elem5;
1136 $this->attributes = $_container4;
1143 * Original thrift struct:-
1144 * StructAsTrait
1146 <<\ThriftTypeInfo(shape('uri' => 'facebook.com/thrift/annotation/hack/StructAsTrait'))>>
1147 class StructAsTrait implements \IThriftSyncStruct, \IThriftShapishSyncStruct {
1148 use \ThriftSerializationTrait;
1150 const dict<int, this::TFieldSpec> SPEC = dict[
1152 const dict<string, int> FIELDMAP = dict[
1155 const type TConstructorShape = shape(
1158 const type TShape = shape(
1160 const int STRUCTURAL_ID = 957977401221134810;
1162 public function __construct()[] {
1165 public static function withDefaultValues()[]: this {
1166 return new static();
1169 public static function fromShape(self::TConstructorShape $shape)[]: this {
1170 return new static(
1174 public static function fromMap_DEPRECATED(@KeyedContainer<string, mixed> $map)[]: this {
1175 return new static(
1179 public function getName()[]: string {
1180 return 'StructAsTrait';
1183 public static function getStructMetadata()[]: \tmeta_ThriftStruct {
1184 return \tmeta_ThriftStruct::fromShape(
1185 shape(
1186 "name" => "hack.StructAsTrait",
1187 "is_union" => false,
1192 public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
1193 return shape(
1194 'struct' => dict[
1195 '\thrift\annotation\Struct' => \thrift\annotation\Struct::fromShape(
1196 shape(
1200 'fields' => dict[
1205 public static function __stringifyMapKeys<T>(dict<arraykey, T> $m)[]: dict<string, T> {
1206 return Dict\map_keys($m, $key ==> (string)$key);
1209 public static function __fromShape(self::TShape $shape)[]: this {
1210 return new static(
1214 public function __toShape()[]: self::TShape {
1215 return shape(
1218 public function getInstanceKey()[write_props]: string {
1219 return \TCompactSerializer::serialize($this);
1222 public function readFromJson(string $jsonText): void {
1223 $parsed = json_decode($jsonText, true);
1225 if ($parsed === null || !($parsed is KeyedContainer<_, _>)) {
1226 throw new \TProtocolException("Cannot parse the given json string.");