@@ -30,12 +30,19 @@ public function __construct(
30
30
$ this ->methodsOfType = $ methodsOfType ;
31
31
}
32
32
33
- public function getConstructorsOfType (string $ type , bool $ methods , bool $ ignoreEmpty = false ): array
33
+ public function getConstructorsOfType (string $ type , bool $ ignoreEmpty = false ): array
34
34
{
35
- $ t = $ methods ? ($ this ->methodsOfType [$ type ] ?? []) : ($ this ->constructorsOfType [$ type ] ?? []);
36
- $ methods = $ methods ? 'methods ' : 'constructors ' ;
35
+ $ t = $ this ->constructorsOfType [$ type ] ?? [];
37
36
if (!$ ignoreEmpty ) {
38
- Assert::notEmpty ($ t , "No {$ methods } found for type: $ type " );
37
+ Assert::notEmpty ($ t , "No constructors found for type: $ type " );
38
+ }
39
+ return $ t ;
40
+ }
41
+ public function getMethodsOfType (string $ type , bool $ ignoreEmpty = false ): array
42
+ {
43
+ $ t = $ this ->methodsOfType [$ type ] ?? [];
44
+ if (!$ ignoreEmpty ) {
45
+ Assert::notEmpty ($ t , "No methods found for type: $ type " );
39
46
}
40
47
return $ t ;
41
48
}
@@ -96,8 +103,8 @@ public function getTypeAtPosition(SimpleExtractorOp $_path): string
96
103
$ hadFlag = false ;
97
104
do {
98
105
if ($ realType !== null
99
- && !isset ($ this ->tl ->getConstructorsOfType ($ realType , true , true )[$ path [$ idx ]])
100
- && !isset ($ this ->tl ->getConstructorsOfType ($ realType, false , true )[$ path [$ idx ]])
106
+ && !isset ($ this ->tl ->getConstructorsOfType ($ realType , true )[$ path [$ idx ]])
107
+ && !isset ($ this ->tl ->getMethodsOfType ($ realType , true )[$ path [$ idx ]])
101
108
) {
102
109
throw new AssertionError ("{$ path [$ idx ]} is NOT a constructor of type $ type, path: " . json_encode ($ path ));
103
110
}
@@ -794,7 +801,7 @@ public function build(TLContext $tl): array
794
801
$ TL = new TLWrapper ($ TL );
795
802
$ locations = [];
796
803
797
- foreach ($ TL ->getConstructorsOfType ('Message ' , false ) as $ constructor => $ _ ) {
804
+ foreach ($ TL ->getConstructorsOfType ('Message ' ) as $ constructor => $ _ ) {
798
805
if ($ constructor === 'messageEmpty ' ) {
799
806
continue ;
800
807
}
@@ -870,7 +877,7 @@ public function build(TLContext $tl): array
870
877
]
871
878
);
872
879
$ locations ['help.getPremiumPromo ' ][] = new CopyMethodCallOp ('help.getPremiumPromo ' );
873
- foreach ($ TL ->getConstructorsOfType ('payments.StarsStatus ' , true ) as $ method => $ _ ) {
880
+ foreach ($ TL ->getMethodsOfType ('payments.StarsStatus ' ) as $ method => $ _ ) {
874
881
$ locations ['starsTransaction ' ][] = new CallOp (
875
882
'payments.getStarsTransactionsByID ' ,
876
883
[
@@ -962,10 +969,10 @@ public function build(TLContext $tl): array
962
969
foreach (['account.savedRingtones ' , 'account.savedRingtoneConverted ' , 'account.uploadRingtone ' ] as $ c ) {
963
970
$ locations [$ c ][] = new CallOp ('account.getSavedRingtones ' , ['hash ' => new LiteralOp ('long ' , 0 )]);
964
971
}
965
- $ locations [ ' recentMeUrlChatInvite ' ][] = new CallOp (
966
- ' messages.checkChatInvite ' ,
967
- [ ' hash ' => new ExtractFromHereOp ([ ' recentMeUrlChatInvite ' , ' url ' ])],
968
- );
972
+
973
+ $ locations [ ' recentMeUrlChatInvite ' ][] = new Noop ( ' Do not store references based on chat invite links ' );
974
+ $ locations [ ' messages.checkChatInvite ' ][] = new Noop ( ' Do not store references based on chat invite links ' );
975
+
969
976
$ locations ['messages.availableEffects ' ][] = new CallOp (
970
977
'messages.getAvailableEffects ' ,
971
978
['hash ' => new LiteralOp ('int ' , 0 )],
@@ -1017,6 +1024,7 @@ public function build(TLContext $tl): array
1017
1024
$ locations ['messages.getPreparedInlineMessage ' ][]= new Noop ('Inline bot results are ephemeral ' );
1018
1025
1019
1026
$ locations ['messages.uploadMedia ' ][]= new Noop ('A freshly uploaded media file will obtain a context only once it is sent to a chat ' );
1027
+ $ locations ['messages.uploadImportedMedia ' ][]= new Noop ('A freshly uploaded media file will obtain a context only once it is sent to a chat ' );
1020
1028
1021
1029
$ locations ['document ' ][] = new CallOp (
1022
1030
'messages.getStickerSet ' ,
@@ -1032,7 +1040,7 @@ public function build(TLContext $tl): array
1032
1040
1033
1041
// Ignore these for now
1034
1042
foreach (['payments.ResaleStarGifts ' , 'payments.StarGiftUpgradePreview ' , 'StarGift ' ] as $ type ) {
1035
- foreach ($ TL ->getConstructorsOfType ($ type, false ) as $ constructor => $ _ ) {
1043
+ foreach ($ TL ->getConstructorsOfType ($ type ) as $ constructor => $ _ ) {
1036
1044
$ locations [$ constructor ][] = new Noop ('Contexts for star gifts are not yet implemented ' );
1037
1045
}
1038
1046
}
@@ -1062,7 +1070,7 @@ public function build(TLContext $tl): array
1062
1070
$ param ['type ' ] === $ type ||
1063
1071
(
1064
1072
isset ($ param ['subtype ' ])
1065
- && " Vector< { $ param ['subtype ' ]} > " === $ type
1073
+ && $ param ['subtype ' ] === $ type
1066
1074
)
1067
1075
)) {
1068
1076
$ stack [$ posName ] = $ param ['name ' ];
@@ -1075,25 +1083,17 @@ public function build(TLContext $tl): array
1075
1083
}
1076
1084
unset($ stackTypes [$ t ]);
1077
1085
}
1078
- unset($ stack [$ pos ], $ stack [$ posName ]);
1079
-
1080
- if (!$ found ) {
1081
- foreach ($ TL ->getConstructorsOfType ($ type , true , true ) as $ method => $ data ) {
1082
- $ stack [$ posName ] = '' ;
1083
- $ stack [$ pos ] = $ method ;
1084
- $ onStackEnd ($ stack );
1085
- }
1086
- foreach ($ TL ->getConstructorsOfType ("Vector< $ type> " , true , true ) as $ method => $ data ) {
1087
- $ stack [$ posName ] = '' ;
1088
- $ stack [$ pos ] = $ method ;
1089
- $ onStackEnd ($ stack );
1090
- }
1091
- unset($ stack [$ posName ], $ stack [$ pos ]);
1092
-
1093
- } elseif ($ type === 'Update ' ) {
1086
+ foreach ($ TL ->getMethodsOfType ($ type , true ) as $ method => $ data ) {
1087
+ $ stack [$ posName ] = '' ;
1088
+ $ stack [$ pos ] = $ method ;
1094
1089
$ onStackEnd ($ stack );
1095
1090
}
1096
-
1091
+ foreach ($ TL ->getMethodsOfType ("Vector< $ type> " , true ) as $ method => $ data ) {
1092
+ $ stack [$ posName ] = '' ;
1093
+ $ stack [$ pos ] = $ method ;
1094
+ $ onStackEnd ($ stack );
1095
+ }
1096
+ unset($ stack [$ posName ], $ stack [$ pos ]);
1097
1097
};
1098
1098
1099
1099
$ fileRefs = ['Document ' => 'document ' , 'Photo ' => 'photo ' ];
0 commit comments