Skip to content

Commit 07c4f32

Browse files
authored
Drop support for PHP lower than 8.2 (#1967)
* Drop support for PHP lower than 8.2 * Remove dead code related to old PHP versions * Regenerate the Psalm baseline
1 parent 81faaca commit 07c4f32

File tree

6 files changed

+8
-39
lines changed

6 files changed

+8
-39
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
max-parallel: 10
1515
matrix:
16-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
16+
php: ['8.2', '8.3', '8.4', '8.5']
1717

1818
steps:
1919
- name: Set up PHP

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
- AWS api-change: Added `us-isob-west-1` region
88

9+
### Dependency bumped
10+
11+
- Drop support for PHP versions lower than 8.2
12+
913
### Changed
1014

1115
- Apply new CodingStandard from latest php-cs-fixer.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"sts"
1212
],
1313
"require": {
14-
"php": "^7.2.5 || ^8.0",
14+
"php": "^8.2",
1515
"ext-hash": "*",
1616
"ext-json": "*",
1717
"ext-simplexml": "*",

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/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/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;

0 commit comments

Comments
 (0)