@@ -84,7 +84,9 @@ public static function create(string $class, array $data = [])
84
84
// Make sure the Result is initialized
85
85
$ reflectionClass = new \ReflectionClass (Result::class);
86
86
$ initializedProperty = $ reflectionClass ->getProperty ('initialized ' );
87
- $ initializedProperty ->setAccessible (true );
87
+ if (\PHP_VERSION_ID < 80100 ) {
88
+ $ initializedProperty ->setAccessible (true );
89
+ }
88
90
89
91
/** @psalm-var \ReflectionClass<T> $reflectionClass */
90
92
$ reflectionClass = new \ReflectionClass ($ class );
@@ -116,7 +118,9 @@ public static function create(string $class, array $data = [])
116
118
$ property = $ reflectionClass ->getProperty ($ propertyName );
117
119
}
118
120
}
119
- $ property ->setAccessible (true );
121
+ if (\PHP_VERSION_ID < 80100 ) {
122
+ $ property ->setAccessible (true );
123
+ }
120
124
$ property ->setValue ($ object , $ propertyValue );
121
125
}
122
126
@@ -151,10 +155,14 @@ public static function waiter(string $class, string $finalState)
151
155
152
156
$ reflectionClass = new \ReflectionClass (Waiter::class);
153
157
$ propertyResponse = $ reflectionClass ->getProperty ('response ' );
154
- $ propertyResponse ->setAccessible (true );
158
+ if (\PHP_VERSION_ID < 80100 ) {
159
+ $ propertyResponse ->setAccessible (true );
160
+ }
155
161
156
162
$ propertyState = $ reflectionClass ->getProperty ('finalState ' );
157
- $ propertyState ->setAccessible (true );
163
+ if (\PHP_VERSION_ID < 80100 ) {
164
+ $ propertyState ->setAccessible (true );
165
+ }
158
166
159
167
/** @psalm-var \ReflectionClass<T> $reflectionClass */
160
168
$ reflectionClass = new \ReflectionClass ($ class );
@@ -217,7 +225,9 @@ private static function addUndefinedProperties(\ReflectionClass $reflectionClass
217
225
}
218
226
219
227
if (null !== $ propertyValue ) {
220
- $ property ->setAccessible (true );
228
+ if (\PHP_VERSION_ID < 80100 ) {
229
+ $ property ->setAccessible (true );
230
+ }
221
231
$ property ->setValue ($ object , $ propertyValue );
222
232
}
223
233
}
@@ -260,14 +270,18 @@ private static function addPropertiesOnResult(\ReflectionClass $reflectionClass,
260
270
if (class_exists ($ awsClientClass )) {
261
271
$ awsClientMock = (new \ReflectionClass ($ awsClientClass ))->newInstanceWithoutConstructor ();
262
272
$ property = $ reflectionClass ->getProperty ('awsClient ' );
263
- $ property ->setAccessible (true );
273
+ if (\PHP_VERSION_ID < 80100 ) {
274
+ $ property ->setAccessible (true );
275
+ }
264
276
$ property ->setValue ($ object , $ awsClientMock );
265
277
}
266
278
267
279
if (class_exists ($ inputClass )) {
268
280
$ inputMock = (new \ReflectionClass ($ inputClass ))->newInstanceWithoutConstructor ();
269
281
$ property = $ reflectionClass ->getProperty ('input ' );
270
- $ property ->setAccessible (true );
282
+ if (\PHP_VERSION_ID < 80100 ) {
283
+ $ property ->setAccessible (true );
284
+ }
271
285
$ property ->setValue ($ object , $ inputMock );
272
286
}
273
287
}
@@ -278,15 +292,21 @@ private static function getResponseObject(): Response
278
292
$ response = $ reflectionClass ->newInstanceWithoutConstructor ();
279
293
280
294
$ property = $ reflectionClass ->getProperty ('resolveResult ' );
281
- $ property ->setAccessible (true );
295
+ if (\PHP_VERSION_ID < 80100 ) {
296
+ $ property ->setAccessible (true );
297
+ }
282
298
$ property ->setValue ($ response , true );
283
299
284
300
$ property = $ reflectionClass ->getProperty ('bodyDownloaded ' );
285
- $ property ->setAccessible (true );
301
+ if (\PHP_VERSION_ID < 80100 ) {
302
+ $ property ->setAccessible (true );
303
+ }
286
304
$ property ->setValue ($ response , true );
287
305
288
306
$ property = $ reflectionClass ->getProperty ('httpResponse ' );
289
- $ property ->setAccessible (true );
307
+ if (\PHP_VERSION_ID < 80100 ) {
308
+ $ property ->setAccessible (true );
309
+ }
290
310
$ property ->setValue ($ response , new SimpleMockedResponse ());
291
311
292
312
return $ response ;
0 commit comments