@@ -97,7 +97,9 @@ private static function deserializeXmlModel(\SimpleXMLElement $element, $class):
9797
9898 $ type = (string )$ property ->getType ();
9999 $ value = self ::deserializeXmlAny ($ element ->$ name , $ type , $ annotation );
100- $ property ->setAccessible (true );
100+ if (version_compare (PHP_VERSION , '8.5.0 ' , '< ' )) {
101+ $ property ->setAccessible (true );
102+ }
101103 $ property ->setValue ($ obj , $ value );
102104 }
103105
@@ -120,12 +122,12 @@ private static function castToBool(string $value): bool
120122
121123 private static function castToInt (string $ value ): int
122124 {
123- return (int ) $ value ;
125+ return (int )$ value ;
124126 }
125127
126128 private static function castToFloat (string $ value ): float
127129 {
128- return (float ) $ value ;
130+ return (float )$ value ;
129131 }
130132
131133 private static function castToAny (string $ value , string $ type , ?string $ format )
@@ -179,21 +181,29 @@ public static function deserializeOutput(ResultModel $result, OperationOutput $o
179181
180182 //common part
181183 $ p = $ ro ->getProperty ('status ' );
182- $ p ->setAccessible (true );
184+ if (version_compare (PHP_VERSION , '8.5.0 ' , '< ' )) {
185+ $ p ->setAccessible (true );
186+ }
183187 $ p ->setValue ($ result , $ output ->getStatus ());
184188
185189 $ p = $ ro ->getProperty ('statusCode ' );
186- $ p ->setAccessible (true );
190+ if (version_compare (PHP_VERSION , '8.5.0 ' , '< ' )) {
191+ $ p ->setAccessible (true );
192+ }
187193 $ p ->setValue ($ result , $ output ->GetStatusCode ());
188194
189195 $ headers = $ output ->getHeaders () ?? [];
190196 $ p = $ ro ->getProperty ('headers ' );
191- $ p ->setAccessible (true );
197+ if (version_compare (PHP_VERSION , '8.5.0 ' , '< ' )) {
198+ $ p ->setAccessible (true );
199+ }
192200 $ p ->setValue ($ result , $ headers );
193201
194202 if (isset ($ headers ['x-oss-request-id ' ])) {
195203 $ p = $ ro ->getProperty ('requestId ' );
196- $ p ->setAccessible (true );
204+ if (version_compare (PHP_VERSION , '8.5.0 ' , '< ' )) {
205+ $ p ->setAccessible (true );
206+ }
197207 $ p ->setValue ($ result , $ headers ['x-oss-request-id ' ]);
198208 }
199209
@@ -233,8 +243,10 @@ public static function deserializeOutputHeaders(ResultModel $result, OperationOu
233243 continue ;
234244 }
235245
236- $ value = self ::castToAny ( $ headers [$ name ], $ annotation ->type , $ annotation ->format );
237- $ property ->setAccessible (true );
246+ $ value = self ::castToAny ($ headers [$ name ], $ annotation ->type , $ annotation ->format );
247+ if (version_compare (PHP_VERSION , '8.5.0 ' , '< ' )) {
248+ $ property ->setAccessible (true );
249+ }
238250 $ property ->setValue ($ result , $ value );
239251 }
240252
@@ -243,15 +255,17 @@ public static function deserializeOutputHeaders(ResultModel $result, OperationOu
243255 $ property = $ item ['property ' ];
244256 $ prefix = strtolower ($ annotation ->rename );
245257 $ len = strlen ($ prefix );
246- $ meta = [];
247- foreach ($ headers as $ key => $ value ) {
258+ $ meta = [];
259+ foreach ($ headers as $ key => $ value ) {
248260 if (strncasecmp ($ key , $ prefix , $ len ) == 0 ) {
249261 $ meta [strtolower (substr ($ key , $ len ))] = $ value ;
250262 }
251263 }
252264
253265 if (count ($ meta ) > 0 ) {
254- $ property ->setAccessible (true );
266+ if (version_compare (PHP_VERSION , '8.5.0 ' , '< ' )) {
267+ $ property ->setAccessible (true );
268+ }
255269 $ property ->setValue ($ result , $ meta );
256270 }
257271 }
@@ -280,7 +294,9 @@ public static function deserializeOutputBody(ResultModel $result, OperationOutpu
280294
281295 if ('xml ' === $ annotation ->format ) {
282296 $ value = self ::deserializeXml ($ content , $ annotation ->type , $ annotation ->rename );
283- $ property ->setAccessible (true );
297+ if (version_compare (PHP_VERSION , '8.5.0 ' , '< ' )) {
298+ $ property ->setAccessible (true );
299+ }
284300 $ property ->setValue ($ result , $ value );
285301 } else {
286302 throw new DeserializationExecption ("Unsupport body format: $ annotation ->format " );
@@ -292,7 +308,7 @@ public static function deserializeOutputBody(ResultModel $result, OperationOutpu
292308 }
293309
294310 public static function deserializeOutputInnerBody (ResultModel $ result , OperationOutput $ output )
295- {
311+ {
296312 $ body = $ output ->getBody ();
297313 if ($ body == null ) {
298314 return ;
0 commit comments