Skip to content

Commit 06d28e4

Browse files
Added PHP 8.4 support
1 parent 8022eba commit 06d28e4

75 files changed

Lines changed: 248 additions & 229 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/php-test-workflow.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ jobs:
1919
dependencies-preference: " "
2020
- php: '8.3'
2121
dependencies-preference: "--prefer-lowest"
22+
- php: '8.4'
23+
dependencies-preference: " "
24+
- php: '8.4'
25+
dependencies-preference: "--prefer-lowest"
2226
fail-fast: false
2327
steps:
2428
- uses: actions/checkout@v4

composer.json

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"homepage": "http://github.com/apigee/apigee-client-php",
1414
"license": "Apache-2.0",
1515
"require": {
16-
"php": "~8.2 || ~8.3",
16+
"php": "~8.2 || ~8.3 || ~8.4",
1717
"ext-json": "*",
1818
"ext-openssl": "*",
1919
"ext-reflection": "*",
@@ -31,7 +31,8 @@
3131
"symfony/options-resolver": "^6.4.8",
3232
"symfony/property-access": "^6.4.9",
3333
"symfony/property-info": "^6.4.9",
34-
"symfony/serializer": "^6.4.9"
34+
"symfony/serializer": "^6.4.9",
35+
"guzzlehttp/promises": "^2.0.3"
3536
},
3637
"require-dev": {
3738
"dms/phpunit-arraysubset-asserts": "^0.4.0",
@@ -47,7 +48,24 @@
4748
"phpunit/phpunit": "^9.6",
4849
"sebastian/comparator": "^4.0.5",
4950
"symfony/cache": "^6.4.9",
50-
"vimeo/psalm": "^5.20"
51+
"vimeo/psalm": "^6.14.0",
52+
"amphp/amp": "^3.1.1",
53+
"amphp/byte-stream": "^2.1.2",
54+
"amphp/cache": "^2.0.1",
55+
"amphp/dns": "^2.4.1",
56+
"amphp/parallel": "^2.3.3",
57+
"amphp/parser": "^1.1.1",
58+
"amphp/socket": "^2.4.0",
59+
"daverandom/libdns": "^2.1.0",
60+
"symfony/console": "^6.4.36 || ^7.0",
61+
"spatie/array-to-xml": "^3.4.4",
62+
"nikic/php-parser": "^5.7.0",
63+
"amphp/pipeline": "^1.2.3",
64+
"amphp/process": "^2.0.3",
65+
"amphp/serialization": "^1.1.0",
66+
"amphp/sync": "^2.0",
67+
"revolt/event-loop": "^1.1.0",
68+
"symfony/filesystem": "^7.4.8"
5169
},
5270
"autoload": {
5371
"psr-4": {

psalm.xml.dist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,18 @@
5555

5656
<RiskyTruthyFalsyComparison errorLevel="info" />
5757

58+
<ClassMustBeFinal errorLevel="info" />
59+
<MissingOverrideAttribute errorLevel="info" />
60+
<PossiblyUnusedMethod errorLevel="info" />
61+
<PossiblyUnusedReturnValue errorLevel="info" />
62+
<PossiblyUnusedParam errorLevel="info" />
63+
<UnusedProperty errorLevel="info" />
64+
<UnusedClass errorLevel="info" />
65+
<UnusedVariable errorLevel="info" />
66+
<UnusedDocblockParam errorLevel="info" />
67+
<UnnecessaryVarAnnotation errorLevel="info" />
68+
<PossiblyUnusedProperty errorLevel="info" />
69+
<UnusedParam errorLevel="info" />
70+
5871
</issueHandlers>
5972
</psalm>

src/Api/ApigeeX/Controller/AcceptedRatePlanController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function acceptRatePlan(RatePlanInterface $ratePlan): AcceptedRatePlanInt
8989

9090
$tmp = json_decode($payload, true);
9191

92-
$payload = json_encode($tmp);
92+
$payload = (string) json_encode($tmp);
9393

9494
$response = $this->client->post($this->getBaseEndpointUri(), $payload);
9595
$this->getEntitySerializer()->setPropertiesFromResponse($response, $acceptedRatePlan);
@@ -144,7 +144,7 @@ protected function alterRequestPayload(array &$payload, AcceptedRatePlanInterfac
144144
* @param array $query_params
145145
* Additional query parameters.
146146
*
147-
* @return \Apigee\Edge\Api\ApigeeX\Entity\AcceptedRatePlanInterface[]
147+
* @return AcceptedRatePlanInterface[]
148148
*
149149
* @psalm-suppress PossiblyNullArrayOffset - id() does not return null here.
150150
*/

src/Api/ApigeeX/Controller/AcceptedRatePlanControllerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface AcceptedRatePlanControllerInterface extends
3535
/**
3636
* Gets all accepted rate plans.
3737
*
38-
* @return \Apigee\Edge\Api\ApigeeX\Entity\AcceptedRatePlanInterface[]
38+
* @return AcceptedRatePlanInterface[]
3939
*/
4040
public function getAllAcceptedRatePlans(): array;
4141

@@ -45,7 +45,7 @@ public function getAllAcceptedRatePlans(): array;
4545
* @param int|null $limit
4646
* @param int $page
4747
*
48-
* @return \Apigee\Edge\Api\ApigeeX\Entity\AcceptedRatePlanInterface[]
48+
* @return AcceptedRatePlanInterface[]
4949
*/
5050
public function getPaginatedAcceptedRatePlanList(?int $limit = null, int $page = 1): array;
5151

src/Api/ApigeeX/Controller/ApiProductController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private function getEligibleProducts(string $type, string $entityId): array
134134
}
135135
}
136136

137-
$current_ms = substr((string) (microtime(true) * 1000), 0);
137+
$current_ms = substr((string) ((int) (microtime(true) * 1000.0)), 0);
138138

139139
foreach ($this->getAvailablexApiProducts($type, $entityId, true) as $item) {
140140
// Create a new rate plan controller.

src/Api/ApigeeX/Controller/AppControllerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function listAppIds(?PagerInterface $pager = null): array;
8282
* @param PagerInterface|null $pager
8383
* Number of results to return.
8484
*
85-
* @return \Apigee\Edge\Api\Management\Entity\AppInterface[]
85+
* @return AppInterface[]
8686
* An array that can contain both developer- and appgroup app entities.
8787
*/
8888
public function listApps(bool $includeCredentials = false, ?PagerInterface $pager = null): array;
@@ -110,7 +110,7 @@ public function listAppIdsByStatus(string $status, ?PagerInterface $pager = null
110110
* @param PagerInterface|null $pager
111111
* Number of results to return.
112112
*
113-
* @return \Apigee\Edge\Api\Management\Entity\AppInterface[]
113+
* @return AppInterface[]
114114
* An array that can contain both developer- and appgroup app entities.
115115
*/
116116
public function listAppsByStatus(

src/Api/ApigeeX/Controller/PaginationHelperTrait.php

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -112,46 +112,45 @@ protected function listEntities(?PagerInterface $pager = null, array $query_para
112112
$responseArray = reset($responseArray);
113113

114114
return $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
115-
} else {
116-
// Default page size set to 1000, because the AppGroupApps endpoint
117-
// does not return nextPageToken unless a pageSize is specified
118-
// in the request parameters.
119-
$pageSize = 1000;
120-
// Pass an empty pager to load all entities.
121-
$responseArray = $this->getResultsInRange($this->createPager($pageSize), $query_params);
122-
// Check flag 'nextPageToken' to get next items from the list.
123-
$nextPageToken = array_key_exists('nextPageToken', $responseArray) ? $responseArray['nextPageToken'] : false;
124-
// Ignore entity type key from response, ex.: developer, apiproduct,
125-
// etc.
126-
$responseArray = reset($responseArray);
127-
// Appgroup can be empty.
128-
if (empty($responseArray) || !is_array($responseArray)) {
129-
return [];
130-
}
131-
$entities = $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
132-
133-
if ($nextPageToken) {
134-
do {
135-
$tmp = $this->getResultsInRange($this->createPager($pageSize, $nextPageToken), $query_params);
136-
// Check the flag 'nextPageToken' to get next items from the list.
137-
$nextPageToken = array_key_exists('nextPageToken', $tmp) ? $tmp['nextPageToken'] : false;
138-
// Ignore entity type key from response, ex.: developer,
139-
// apiproduct, etc.
140-
$tmp = reset($tmp);
141-
// Remove the first item from the list because it is the same
142-
// as the last item of $entities at this moment.
143-
// Apigee X response always starts with the requested entity
144-
// (pageToken).
145-
array_shift($tmp);
146-
$tmpEntities = $this->responseArrayToArrayOfEntities($tmp, $key_provider);
147-
// The returned entity array is keyed by entity id which
148-
// is unique so we can do this.
149-
$entities += $tmpEntities;
150-
} while ($nextPageToken);
151-
}
152-
153-
return $entities;
154115
}
116+
// Default page size set to 1000, because the AppGroupApps endpoint
117+
// does not return nextPageToken unless a pageSize is specified
118+
// in the request parameters.
119+
$pageSize = 1000;
120+
// Pass an empty pager to load all entities.
121+
$responseArray = $this->getResultsInRange($this->createPager($pageSize), $query_params);
122+
// Check flag 'nextPageToken' to get next items from the list.
123+
$nextPageToken = array_key_exists('nextPageToken', $responseArray) ? $responseArray['nextPageToken'] : false;
124+
// Ignore entity type key from response, ex.: developer, apiproduct,
125+
// etc.
126+
$responseArray = reset($responseArray);
127+
// Appgroup can be empty.
128+
if (empty($responseArray) || !is_array($responseArray)) {
129+
return [];
130+
}
131+
$entities = $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
132+
133+
if ($nextPageToken) {
134+
do {
135+
$tmp = $this->getResultsInRange($this->createPager($pageSize, $nextPageToken), $query_params);
136+
// Check the flag 'nextPageToken' to get next items from the list.
137+
$nextPageToken = array_key_exists('nextPageToken', $tmp) ? $tmp['nextPageToken'] : false;
138+
// Ignore entity type key from response, ex.: developer,
139+
// apiproduct, etc.
140+
$tmp = reset($tmp);
141+
// Remove the first item from the list because it is the same
142+
// as the last item of $entities at this moment.
143+
// Apigee X response always starts with the requested entity
144+
// (pageToken).
145+
array_shift($tmp);
146+
$tmpEntities = $this->responseArrayToArrayOfEntities($tmp, $key_provider);
147+
// The returned entity array is keyed by entity id which
148+
// is unique so we can do this.
149+
$entities += $tmpEntities;
150+
} while ($nextPageToken);
151+
}
152+
153+
return $entities;
155154
}
156155

157156
/**

src/Api/ApigeeX/Controller/PrepaidBalanceController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ abstract protected function getPrepaidBalanceEndpoint(): UriInterface;
118118
*
119119
* @param string|null $currencyCode
120120
*
121-
* @return \Apigee\Edge\Api\ApigeeX\Entity\PrepaidBalanceInterface[]
121+
* @return PrepaidBalanceInterface[]
122122
*
123123
* @psalm-suppress PossiblyNullArrayOffset - id() does not return null here.
124124
*/

src/Api/ApigeeX/Controller/PrepaidBalanceControllerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function topUpBalance($amount, $amountnano, string $currencyCode, string
3737
/**
3838
* Gets prepaid balances.
3939
*
40-
* @return \Apigee\Edge\Api\ApigeeX\Entity\PrepaidBalanceInterface[]
40+
* @return PrepaidBalanceInterface[]
4141
*/
4242
public function getPrepaidBalance(): array;
4343
}

0 commit comments

Comments
 (0)