Skip to content

Commit 3a0f944

Browse files
committed
Remove dead code related to old PHP versions
1 parent 58a88c8 commit 3a0f944

File tree

6 files changed

+2
-58
lines changed

6 files changed

+2
-58
lines changed

src/Core/src/Credentials/InstanceProvider.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,12 @@ private function toArray(ResponseInterface $response): array
119119
}
120120

121121
try {
122-
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0));
122+
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR);
123123
} catch (\JsonException $e) {
124124
/** @psalm-suppress all */
125125
throw new JsonException(\sprintf('%s for "%s".', $e->getMessage(), $response->getInfo('url')), $e->getCode());
126126
}
127127

128-
if (\PHP_VERSION_ID < 70300 && \JSON_ERROR_NONE !== json_last_error()) {
129-
/** @psalm-suppress InvalidArgument */
130-
throw new JsonException(\sprintf('%s for "%s".', json_last_error_msg(), $response->getInfo('url')), json_last_error());
131-
}
132-
133128
if (!\is_array($content)) {
134129
/** @psalm-suppress InvalidArgument */
135130
throw new JsonException(\sprintf('JSON content was expected to decode to an array, %s returned for "%s".', \gettype($content), $response->getInfo('url')));

src/Core/src/Credentials/SsoTokenProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private function loadSsoToken(string $sessionName): ?array
150150
$content,
151151
true,
152152
512,
153-
\JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0)
153+
\JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR
154154
);
155155
} catch (\JsonException $e) {
156156
$this->logger->warning(

src/Core/src/Test/ResultMockFactory.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ public static function create(string $class, array $data = [])
8484
// Make sure the Result is initialized
8585
$reflectionClass = new \ReflectionClass(Result::class);
8686
$initializedProperty = $reflectionClass->getProperty('initialized');
87-
if (\PHP_VERSION_ID < 80100) {
88-
$initializedProperty->setAccessible(true);
89-
}
9087

9188
/** @psalm-var \ReflectionClass<T> $reflectionClass */
9289
$reflectionClass = new \ReflectionClass($class);
@@ -118,9 +115,6 @@ public static function create(string $class, array $data = [])
118115
$property = $reflectionClass->getProperty($propertyName);
119116
}
120117
}
121-
if (\PHP_VERSION_ID < 80100) {
122-
$property->setAccessible(true);
123-
}
124118
$property->setValue($object, $propertyValue);
125119
}
126120

@@ -155,14 +149,8 @@ public static function waiter(string $class, string $finalState)
155149

156150
$reflectionClass = new \ReflectionClass(Waiter::class);
157151
$propertyResponse = $reflectionClass->getProperty('response');
158-
if (\PHP_VERSION_ID < 80100) {
159-
$propertyResponse->setAccessible(true);
160-
}
161152

162153
$propertyState = $reflectionClass->getProperty('finalState');
163-
if (\PHP_VERSION_ID < 80100) {
164-
$propertyState->setAccessible(true);
165-
}
166154

167155
/** @psalm-var \ReflectionClass<T> $reflectionClass */
168156
$reflectionClass = new \ReflectionClass($class);
@@ -225,9 +213,6 @@ private static function addUndefinedProperties(\ReflectionClass $reflectionClass
225213
}
226214

227215
if (null !== $propertyValue) {
228-
if (\PHP_VERSION_ID < 80100) {
229-
$property->setAccessible(true);
230-
}
231216
$property->setValue($object, $propertyValue);
232217
}
233218
}
@@ -270,18 +255,12 @@ private static function addPropertiesOnResult(\ReflectionClass $reflectionClass,
270255
if (class_exists($awsClientClass)) {
271256
$awsClientMock = (new \ReflectionClass($awsClientClass))->newInstanceWithoutConstructor();
272257
$property = $reflectionClass->getProperty('awsClient');
273-
if (\PHP_VERSION_ID < 80100) {
274-
$property->setAccessible(true);
275-
}
276258
$property->setValue($object, $awsClientMock);
277259
}
278260

279261
if (class_exists($inputClass)) {
280262
$inputMock = (new \ReflectionClass($inputClass))->newInstanceWithoutConstructor();
281263
$property = $reflectionClass->getProperty('input');
282-
if (\PHP_VERSION_ID < 80100) {
283-
$property->setAccessible(true);
284-
}
285264
$property->setValue($object, $inputMock);
286265
}
287266
}
@@ -292,21 +271,12 @@ private static function getResponseObject(): Response
292271
$response = $reflectionClass->newInstanceWithoutConstructor();
293272

294273
$property = $reflectionClass->getProperty('resolveResult');
295-
if (\PHP_VERSION_ID < 80100) {
296-
$property->setAccessible(true);
297-
}
298274
$property->setValue($response, true);
299275

300276
$property = $reflectionClass->getProperty('bodyDownloaded');
301-
if (\PHP_VERSION_ID < 80100) {
302-
$property->setAccessible(true);
303-
}
304277
$property->setValue($response, true);
305278

306279
$property = $reflectionClass->getProperty('httpResponse');
307-
if (\PHP_VERSION_ID < 80100) {
308-
$property->setAccessible(true);
309-
}
310280
$property->setValue($response, new SimpleMockedResponse());
311281

312282
return $response;

src/Integration/Laravel/Cache/tests/Unit/ServiceProviderTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ public function testCreateStore()
2323
self::assertInstanceOf(AsyncAwsDynamoDbStore::class, $store);
2424
$refl = new \ReflectionClass($store);
2525
$property = $refl->getProperty('dynamoDb');
26-
if (\PHP_VERSION_ID < 80100) {
27-
$property->setAccessible(true);
28-
}
2926
$client = $property->getValue($store);
3027

3128
$config = $client->getConfiguration();

src/Integration/Symfony/Bundle/tests/Functional/BundleInitializationTest.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ public function testIssue1758Cache()
186186

187187
$r = new \ReflectionObject($cache);
188188
$p = $r->getProperty('cache');
189-
if (\PHP_VERSION_ID < 80100) {
190-
$p->setAccessible(true);
191-
}
192189

193190
$adapter = $p->getValue($cache);
194191
self::assertInstanceOf(ApcuAdapter::class, $adapter);
@@ -207,9 +204,6 @@ public function testIssue1758Provider()
207204

208205
$r = new \ReflectionClass(AbstractApi::class);
209206
$p = $r->getProperty('credentialProvider');
210-
if (\PHP_VERSION_ID < 80100) {
211-
$p->setAccessible(true);
212-
}
213207

214208
$credentialProvider = $p->getValue($client);
215209
self::assertInstanceOf(InstanceProvider::class, $credentialProvider);
@@ -230,9 +224,6 @@ public function testIssue1758ProviderAndCache()
230224

231225
$r = new \ReflectionClass(AbstractApi::class);
232226
$p = $r->getProperty('credentialProvider');
233-
if (\PHP_VERSION_ID < 80100) {
234-
$p->setAccessible(true);
235-
}
236227

237228
$credentialProvider = $p->getValue($client);
238229
self::assertInstanceOf(CacheProvider::class, $credentialProvider);
@@ -241,17 +232,11 @@ public function testIssue1758ProviderAndCache()
241232

242233
$r = new \ReflectionObject($cache);
243234
$p = $r->getProperty('cache');
244-
if (\PHP_VERSION_ID < 80100) {
245-
$p->setAccessible(true);
246-
}
247235

248236
$adapter = $p->getValue($cache);
249237
self::assertInstanceOf(ApcuAdapter::class, $adapter);
250238

251239
$p = $r->getProperty('decorated');
252-
if (\PHP_VERSION_ID < 80100) {
253-
$p->setAccessible(true);
254-
}
255240

256241
$decorated = $p->getValue($cache);
257242
self::assertInstanceOf(InstanceProvider::class, $decorated);

src/Service/Ses/tests/Unit/SesClientTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ public function testSignService()
159159
$ses = new SesClient([], new NullProvider());
160160
$refl = new \ReflectionClass($ses);
161161
$method = $refl->getMethod('getEndpointMetadata');
162-
if (\PHP_VERSION_ID < 80100) {
163-
$method->setAccessible(true);
164-
}
165162
$data = $method->invokeArgs($ses, ['eu-central-1']);
166163

167164
self::assertEquals('ses', $data['signService']);

0 commit comments

Comments
 (0)