diff --git a/.github/workflows/php-test-workflow.yml b/.github/workflows/php-test-workflow.yml
index b1c2b78ee..75bfcb3fe 100644
--- a/.github/workflows/php-test-workflow.yml
+++ b/.github/workflows/php-test-workflow.yml
@@ -19,6 +19,14 @@ jobs:
dependencies-preference: " "
- php: '8.3'
dependencies-preference: "--prefer-lowest"
+ - php: '8.4'
+ dependencies-preference: " "
+ - php: '8.4'
+ dependencies-preference: "--prefer-lowest"
+ - php: '8.5'
+ dependencies-preference: " "
+ - php: '8.5'
+ dependencies-preference: "--prefer-lowest"
fail-fast: false
steps:
- uses: actions/checkout@v4
diff --git a/composer.json b/composer.json
index d5a264482..0a83d438a 100644
--- a/composer.json
+++ b/composer.json
@@ -13,7 +13,7 @@
"homepage": "http://github.com/apigee/apigee-client-php",
"license": "Apache-2.0",
"require": {
- "php": "~8.2 || ~8.3",
+ "php": "~8.2 || ~8.3 || ~8.4 || ~8.5",
"ext-json": "*",
"ext-openssl": "*",
"ext-reflection": "*",
@@ -28,14 +28,14 @@
"php-http/message-factory": "^1.0",
"phpdocumentor/reflection-docblock": "^5.0",
"psr/http-message": "^1.0 || ^2.0",
- "symfony/options-resolver": "^7.4.0",
- "symfony/property-access": "^7.4.4",
- "symfony/property-info": "^7.4.0",
- "symfony/serializer": "^7.3.0"
+ "symfony/options-resolver": "^7.4.8",
+ "symfony/property-access": "^7.4.8",
+ "symfony/property-info": "^7.4.8",
+ "symfony/serializer": "^7.4.8"
},
"require-dev": {
"dms/phpunit-arraysubset-asserts": "^0.4.0",
- "friendsofphp/php-cs-fixer": "^3.68",
+ "friendsofphp/php-cs-fixer": "^3.80",
"fzaninotto/faker": "^1.7",
"guzzlehttp/psr7": "^2.5",
"league/flysystem": "^1.0",
@@ -46,10 +46,27 @@
"phpmetrics/phpmetrics": "^2.7",
"phpunit/phpunit": "^9.6",
"sebastian/comparator": "^4.0.5",
- "symfony/cache": "^7.3.0",
- "symfony/type-info": "^7.3.0",
- "symfony/var-exporter": "^7.3.0",
- "vimeo/psalm": "^5.20"
+ "symfony/cache": "^7.4.8",
+ "symfony/type-info": "^7.4.8",
+ "symfony/var-exporter": "^7.4.8",
+ "vimeo/psalm": "^6.14.0",
+ "amphp/amp": "^3.1.1",
+ "amphp/byte-stream": "^2.1.2",
+ "amphp/cache": "^2.0.1",
+ "amphp/dns": "^2.4.1",
+ "amphp/parallel": "^2.3.3",
+ "amphp/parser": "^1.1.1",
+ "amphp/socket": "^2.4.0",
+ "daverandom/libdns": "^2.1.0",
+ "symfony/console": "^6.4.36 || ^7.0",
+ "spatie/array-to-xml": "^3.4.4",
+ "nikic/php-parser": "^5.7.0",
+ "amphp/pipeline": "^1.2.3",
+ "amphp/process": "^2.0.3",
+ "amphp/serialization": "^1.1.0",
+ "amphp/sync": "^2.0",
+ "revolt/event-loop": "^1.1.0",
+ "symfony/filesystem": "^7.4.8"
},
"autoload": {
"psr-4": {
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 087b02a20..f6d012d9f 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,5 +1,4 @@
-
-
-
-
-
-
+
-
-
-
- tests/
-
-
-
-
- ./src
-
-
+
+
+
+ tests/
+
+
diff --git a/psalm.xml.dist b/psalm.xml.dist
index 065e811dd..3bf943e92 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -7,7 +7,7 @@
allowStringToStandInForClass="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
- xsi:schemaLocation="https://getpsalm.org/schema/config file:///var/www/html/vendor/vimeo/psalm/config.xsd"
+ xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
@@ -54,6 +54,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Api/ApigeeX/Controller/AcceptedRatePlanController.php b/src/Api/ApigeeX/Controller/AcceptedRatePlanController.php
index d73577dee..23df4fa88 100755
--- a/src/Api/ApigeeX/Controller/AcceptedRatePlanController.php
+++ b/src/Api/ApigeeX/Controller/AcceptedRatePlanController.php
@@ -89,7 +89,7 @@ public function acceptRatePlan(RatePlanInterface $ratePlan): AcceptedRatePlanInt
$tmp = json_decode($payload, true);
- $payload = json_encode($tmp);
+ $payload = (string) json_encode($tmp);
$response = $this->client->post($this->getBaseEndpointUri(), $payload);
$this->getEntitySerializer()->setPropertiesFromResponse($response, $acceptedRatePlan);
diff --git a/src/Api/ApigeeX/Controller/ApiProductController.php b/src/Api/ApigeeX/Controller/ApiProductController.php
index 696eb99a9..4d57effe0 100755
--- a/src/Api/ApigeeX/Controller/ApiProductController.php
+++ b/src/Api/ApigeeX/Controller/ApiProductController.php
@@ -134,7 +134,7 @@ private function getEligibleProducts(string $type, string $entityId): array
}
}
- $current_ms = substr((string) (microtime(true) * 1000), 0);
+ $current_ms = substr((string) (microtime(true) * 1000.0), 0);
foreach ($this->getAvailablexApiProducts($type, $entityId, true) as $item) {
// Create a new rate plan controller.
diff --git a/src/Api/ApigeeX/Controller/RatePlanController.php b/src/Api/ApigeeX/Controller/RatePlanController.php
index bb5f414f8..32871ef7a 100755
--- a/src/Api/ApigeeX/Controller/RatePlanController.php
+++ b/src/Api/ApigeeX/Controller/RatePlanController.php
@@ -92,7 +92,7 @@ public function getEntities(?bool $showCurrentOnly = null, ?bool $showPrivate =
public function createNewRevision(RatePlanRevisionInterface $entity): void
{
$payload = $this->getEntitySerializer()->serialize($entity, 'json');
- $response = $this->getClient()->post($this->getEntityEndpointUri($entity->getPreviousRatePlanRevision()->id()) . '/revision', $payload);
+ $response = $this->getClient()->post((string) $this->getEntityEndpointUri($entity->getPreviousRatePlanRevision()->id()) . '/revision', $payload);
$this->getEntitySerializer()->setPropertiesFromResponse($response, $entity);
}
diff --git a/src/Api/ApigeeX/Denormalizer/AcceptedRatePlanDenormalizer.php b/src/Api/ApigeeX/Denormalizer/AcceptedRatePlanDenormalizer.php
index ebc4e9101..663df8570 100755
--- a/src/Api/ApigeeX/Denormalizer/AcceptedRatePlanDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/AcceptedRatePlanDenormalizer.php
@@ -50,6 +50,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return AcceptedRatePlanInterface::class === $type || $type instanceof AcceptedRatePlanInterface || in_array(AcceptedRatePlanInterface::class, class_implements($type));
+ return AcceptedRatePlanInterface::class === $type || $type instanceof AcceptedRatePlanInterface || in_array(AcceptedRatePlanInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/ApigeeX/Denormalizer/ApiProductDenormalizer.php b/src/Api/ApigeeX/Denormalizer/ApiProductDenormalizer.php
index 17b950fb8..1e47b9538 100755
--- a/src/Api/ApigeeX/Denormalizer/ApiProductDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/ApiProductDenormalizer.php
@@ -52,6 +52,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return ApiProductInterface::class === $type || $type instanceof ApiProductInterface || in_array(ApiProductInterface::class, class_implements($type));
+ return ApiProductInterface::class === $type || $type instanceof ApiProductInterface || in_array(ApiProductInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php b/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php
index 63be5b096..249d08f41 100644
--- a/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php
@@ -68,7 +68,7 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return AppInterface::class === $type || $type instanceof AppInterface || in_array(AppInterface::class, class_implements($type));
+ return AppInterface::class === $type || $type instanceof AppInterface || in_array(AppInterface::class, class_implements($type) ?: []);
}
/**
diff --git a/src/Api/ApigeeX/Denormalizer/BillingTypeDenormalizer.php b/src/Api/ApigeeX/Denormalizer/BillingTypeDenormalizer.php
index f5e73ca1d..1b5e168d0 100644
--- a/src/Api/ApigeeX/Denormalizer/BillingTypeDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/BillingTypeDenormalizer.php
@@ -44,6 +44,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return BillingTypeInterface::class === $type || $type instanceof BillingTypeInterface || in_array(BillingTypeInterface::class, class_implements($type));
+ return BillingTypeInterface::class === $type || $type instanceof BillingTypeInterface || in_array(BillingTypeInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/ApigeeX/Denormalizer/PrepaidBalanceDenormalizer.php b/src/Api/ApigeeX/Denormalizer/PrepaidBalanceDenormalizer.php
index 51f6d1f7c..cdbe7c3fb 100755
--- a/src/Api/ApigeeX/Denormalizer/PrepaidBalanceDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/PrepaidBalanceDenormalizer.php
@@ -52,6 +52,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return PrepaidBalanceInterface::class === $type || $type instanceof PrepaidBalanceInterface || in_array(PrepaidBalanceInterface::class, class_implements($type));
+ return PrepaidBalanceInterface::class === $type || $type instanceof PrepaidBalanceInterface || in_array(PrepaidBalanceInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizer.php b/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizer.php
index c28410602..f9f6c7739 100755
--- a/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizer.php
@@ -72,6 +72,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return RatePlanInterface::class === $type || $type instanceof RatePlanInterface || in_array(RatePlanInterface::class, class_implements($type));
+ return RatePlanInterface::class === $type || $type instanceof RatePlanInterface || in_array(RatePlanInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/ApigeeX/Entity/Property/NanosPropertyAwareTrait.php b/src/Api/ApigeeX/Entity/Property/NanosPropertyAwareTrait.php
index 47bc2e201..f049eaab6 100755
--- a/src/Api/ApigeeX/Entity/Property/NanosPropertyAwareTrait.php
+++ b/src/Api/ApigeeX/Entity/Property/NanosPropertyAwareTrait.php
@@ -33,9 +33,9 @@ trait NanosPropertyAwareTrait
*/
public function getNanos(): ?float
{
- $nanos = $this->nanos ?? 0;
+ $nanos = $this->nanos ?? 0.0;
- return $nanos * pow(10, -9);
+ return $nanos * 1e-9;
}
/**
diff --git a/src/Api/ApigeeX/Normalizer/AcceptedRatePlanNormalizer.php b/src/Api/ApigeeX/Normalizer/AcceptedRatePlanNormalizer.php
index 18cb79f17..86dfeeaff 100755
--- a/src/Api/ApigeeX/Normalizer/AcceptedRatePlanNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/AcceptedRatePlanNormalizer.php
@@ -21,6 +21,7 @@
use Apigee\Edge\Api\ApigeeX\Entity\AcceptedRatePlanInterface;
use Apigee\Edge\Api\Monetization\Normalizer\EntityNormalizer;
use Apigee\Edge\Api\Monetization\Utility\TimezoneFixerHelperTrait;
+use ArrayObject;
class AcceptedRatePlanNormalizer extends EntityNormalizer
{
@@ -32,7 +33,7 @@ class AcceptedRatePlanNormalizer extends EntityNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var AcceptedRatePlanInterface $data */
/** @var object $normalized */
diff --git a/src/Api/ApigeeX/Normalizer/ApiProductNormalizer.php b/src/Api/ApigeeX/Normalizer/ApiProductNormalizer.php
index ceb5f712d..354b22d51 100755
--- a/src/Api/ApigeeX/Normalizer/ApiProductNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/ApiProductNormalizer.php
@@ -21,6 +21,7 @@
use Apigee\Edge\Api\ApigeeX\Entity\ApiProductInterface;
use Apigee\Edge\Api\Monetization\NameConverter\ApiPackageNameConverter;
use Apigee\Edge\Api\Monetization\Normalizer\EntityNormalizer;
+use ArrayObject;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -48,7 +49,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/ApigeeX/Normalizer/AppGroupMembershipNormalizer.php b/src/Api/ApigeeX/Normalizer/AppGroupMembershipNormalizer.php
index 73f6644c0..1fb07cebb 100644
--- a/src/Api/ApigeeX/Normalizer/AppGroupMembershipNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/AppGroupMembershipNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Api\ApigeeX\Normalizer;
use Apigee\Edge\Api\ApigeeX\Structure\AppGroupMembership;
+use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class AppGroupMembershipNormalizer implements NormalizerInterface
@@ -29,7 +30,7 @@ class AppGroupMembershipNormalizer implements NormalizerInterface
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
$normalized = [];
diff --git a/src/Api/ApigeeX/Normalizer/AppNormalizer.php b/src/Api/ApigeeX/Normalizer/AppNormalizer.php
index c55a39dc0..6abc380de 100644
--- a/src/Api/ApigeeX/Normalizer/AppNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/AppNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\Management\Entity\AppInterface;
use Apigee\Edge\Normalizer\ObjectNormalizer;
+use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
@@ -41,7 +42,7 @@ public function supportsNormalization($data, $format = null, array $context = []
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/ApigeeX/Normalizer/BillingTypeNormalizer.php b/src/Api/ApigeeX/Normalizer/BillingTypeNormalizer.php
index 6d3912899..0f8cc934b 100644
--- a/src/Api/ApigeeX/Normalizer/BillingTypeNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/BillingTypeNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\ApigeeX\Entity\BillingTypeInterface;
use Apigee\Edge\Api\Monetization\Normalizer\EntityNormalizer;
+use ArrayObject;
class BillingTypeNormalizer extends EntityNormalizer
{
@@ -29,7 +30,7 @@ class BillingTypeNormalizer extends EntityNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var BillingTypeInterface $data */
/** @var object $normalized */
diff --git a/src/Api/ApigeeX/Normalizer/RatePlanNormalizer.php b/src/Api/ApigeeX/Normalizer/RatePlanNormalizer.php
index 987cbdf79..ac1d79e79 100755
--- a/src/Api/ApigeeX/Normalizer/RatePlanNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/RatePlanNormalizer.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Api\Monetization\Normalizer\EntityNormalizer;
use Apigee\Edge\Api\Monetization\Utility\TimezoneFixerHelperTrait;
use Apigee\Edge\Exception\UninitializedPropertyException;
+use ArrayObject;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -52,7 +53,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php b/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php
index 20f3d45c8..a49c0a829 100755
--- a/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php
+++ b/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php
@@ -21,6 +21,7 @@
use Apigee\Edge\Api\Monetization\Normalizer\CompanyRatePlanNormalizer;
use Apigee\Edge\Api\Monetization\Normalizer\DeveloperCategoryRatePlanNormalizer;
use Apigee\Edge\Api\Monetization\Normalizer\DeveloperRatePlanNormalizer;
+use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\SerializerAwareInterface;
use Symfony\Component\Serializer\SerializerAwareTrait;
@@ -56,7 +57,7 @@ public function __construct(array $normalizers = [])
* @psalm-suppress InvalidNullableReturnType - There are going to be at
* least one normalizer always that can normalize data here.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
foreach ($this->normalizers as $normalizer) {
// Return the result from the first denormalizer that can
diff --git a/src/Api/ApigeeX/Normalizer/RatePlanRateNormalizer.php b/src/Api/ApigeeX/Normalizer/RatePlanRateNormalizer.php
index 088cbc4c5..1240124d9 100755
--- a/src/Api/ApigeeX/Normalizer/RatePlanRateNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/RatePlanRateNormalizer.php
@@ -21,6 +21,7 @@
use Apigee\Edge\Api\Monetization\Structure\RatePlanRate;
use Apigee\Edge\Api\Monetization\Structure\RatePlanRateRevShare;
use Apigee\Edge\Normalizer\ObjectNormalizer;
+use ArrayObject;
class RatePlanRateNormalizer extends ObjectNormalizer
{
@@ -30,7 +31,7 @@ class RatePlanRateNormalizer extends ObjectNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/ApigeeX/Normalizer/StandardRatePlanNormalizer.php b/src/Api/ApigeeX/Normalizer/StandardRatePlanNormalizer.php
index 6b72264ba..2f1273807 100755
--- a/src/Api/ApigeeX/Normalizer/StandardRatePlanNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/StandardRatePlanNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\ApigeeX\Entity\RatePlanInterface;
use Apigee\Edge\Api\ApigeeX\Entity\StandardRatePlanInterface;
+use ArrayObject;
class StandardRatePlanNormalizer extends RatePlanNormalizer
{
@@ -29,7 +30,7 @@ class StandardRatePlanNormalizer extends RatePlanNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Management/Controller/AttributesAwareEntityControllerTrait.php b/src/Api/Management/Controller/AttributesAwareEntityControllerTrait.php
index 5f5f3f820..94de485fb 100644
--- a/src/Api/Management/Controller/AttributesAwareEntityControllerTrait.php
+++ b/src/Api/Management/Controller/AttributesAwareEntityControllerTrait.php
@@ -114,7 +114,7 @@ public function deleteAttribute(string $entityId, string $name): void
protected function getEntityAttributesUri(string $entityId): UriInterface
{
$uri = $this->getEntityEndpointUri($entityId)->withPath(
- $this->getEntityEndpointUri($entityId) . '/attributes'
+ (string) $this->getEntityEndpointUri($entityId) . '/attributes'
);
return $uri;
@@ -132,7 +132,7 @@ protected function getEntityAttributeUri(string $entityId, string $name): UriInt
{
$encoded = rawurlencode($name);
$uri = $this->getEntityAttributesUri($entityId)->withPath(
- $this->getEntityAttributesUri($entityId) . '/' . $encoded
+ (string) $this->getEntityAttributesUri($entityId) . '/' . $encoded
);
return $uri;
diff --git a/src/Api/Management/Denormalizer/AppDenormalizer.php b/src/Api/Management/Denormalizer/AppDenormalizer.php
index c57c77f0e..e10852429 100644
--- a/src/Api/Management/Denormalizer/AppDenormalizer.php
+++ b/src/Api/Management/Denormalizer/AppDenormalizer.php
@@ -68,6 +68,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return AppInterface::class === $type || $type instanceof AppInterface || in_array(AppInterface::class, class_implements($type));
+ return AppInterface::class === $type || $type instanceof AppInterface || in_array(AppInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/Management/Normalizer/AppCredentialNormalizer.php b/src/Api/Management/Normalizer/AppCredentialNormalizer.php
index 367481861..7728068d8 100644
--- a/src/Api/Management/Normalizer/AppCredentialNormalizer.php
+++ b/src/Api/Management/Normalizer/AppCredentialNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\Management\Entity\AppCredentialInterface;
use Apigee\Edge\Normalizer\ObjectNormalizer;
+use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
@@ -41,7 +42,7 @@ public function supportsNormalization($data, $format = null, array $context = []
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Management/Normalizer/AppNormalizer.php b/src/Api/Management/Normalizer/AppNormalizer.php
index f0f658d51..28b32bf55 100644
--- a/src/Api/Management/Normalizer/AppNormalizer.php
+++ b/src/Api/Management/Normalizer/AppNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\Management\Entity\AppInterface;
use Apigee\Edge\Normalizer\ObjectNormalizer;
+use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
@@ -41,7 +42,7 @@ public function supportsNormalization($data, $format = null, array $context = []
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php b/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php
index b2b3a34db..c605a02b4 100644
--- a/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php
+++ b/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Api\Management\Normalizer;
use Apigee\Edge\Api\Management\Structure\CompanyMembership;
+use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class CompanyMembershipNormalizer implements NormalizerInterface
@@ -29,7 +30,7 @@ class CompanyMembershipNormalizer implements NormalizerInterface
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
$normalized = [
'developer' => [],
@@ -39,9 +40,9 @@ public function normalize($data, $format = null, array $context = []): array|str
$normalized['developer'][] = (object) ['email' => $member, 'role' => $role];
}
- // convert to \ArrayObject as symfony normalizer throws error for std object.
+ // convert to ArrayObject as symfony normalizer throws error for std object.
// set ARRAY_AS_PROPS flag as we need entries to be accessed as properties.
- return new \ArrayObject($normalized, \ArrayObject::ARRAY_AS_PROPS);
+ return new ArrayObject($normalized, ArrayObject::ARRAY_AS_PROPS);
}
/**
diff --git a/src/Api/Management/Query/StatsQueryNormalizer.php b/src/Api/Management/Query/StatsQueryNormalizer.php
index c1e82bbea..8449cb7f6 100644
--- a/src/Api/Management/Query/StatsQueryNormalizer.php
+++ b/src/Api/Management/Query/StatsQueryNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Api\Management\Query;
use Apigee\Edge\Serializer\JsonEncoder;
+use ArrayObject;
use DateTimeZone;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@@ -52,7 +53,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var StatsQueryInterface $data */
// Transform the object to JSON and back to an array to keep boolean values as boolean.
diff --git a/src/Api/Monetization/Controller/AcceptedRatePlanController.php b/src/Api/Monetization/Controller/AcceptedRatePlanController.php
index 378b6022b..d24c7590b 100644
--- a/src/Api/Monetization/Controller/AcceptedRatePlanController.php
+++ b/src/Api/Monetization/Controller/AcceptedRatePlanController.php
@@ -99,7 +99,7 @@ public function acceptRatePlan(RatePlanInterface $ratePlan, DateTimeImmutable $s
if (null !== $waveTerminationCharge) {
$tmp['waveTerminationCharge'] = $waveTerminationCharge ? 'true' : 'false';
}
- $payload = json_encode($tmp);
+ $payload = (string) json_encode($tmp);
$response = $this->client->post($this->getBaseEndpointUri(), $payload);
$this->getEntitySerializer()->setPropertiesFromResponse($response, $acceptedRatePlan);
@@ -122,7 +122,7 @@ public function updateSubscription(AcceptedRatePlanInterface $acceptedRatePlan,
$tmp['waveTerminationCharge'] = $waveTerminationCharge ? 'true' : 'false';
}
$this->alterRequestPayload($tmp, $acceptedRatePlan);
- $payload = json_encode($tmp);
+ $payload = (string) json_encode($tmp);
// Update an existing entity.
$response = $this->client->put($this->getEntityEndpointUri($acceptedRatePlan->id()), $payload);
$this->getEntitySerializer()->setPropertiesFromResponse($response, $acceptedRatePlan);
diff --git a/src/Api/Monetization/Controller/RatePlanController.php b/src/Api/Monetization/Controller/RatePlanController.php
index 148ab2e3e..18e767979 100644
--- a/src/Api/Monetization/Controller/RatePlanController.php
+++ b/src/Api/Monetization/Controller/RatePlanController.php
@@ -79,6 +79,9 @@ public function getEntities(?bool $showCurrentOnly = null, ?bool $showPrivate =
$responseArray = $this->responseToArray($response);
// Ignore entity type key from response, ex.: product.
$responseArray = reset($responseArray);
+ if (!is_array($responseArray)) {
+ $responseArray = [];
+ }
return $this->responseArrayToArrayOfEntities($responseArray);
}
@@ -94,7 +97,7 @@ public function getEntities(?bool $showCurrentOnly = null, ?bool $showPrivate =
public function createNewRevision(RatePlanRevisionInterface $entity): void
{
$payload = $this->getEntitySerializer()->serialize($entity, 'json');
- $response = $this->getClient()->post($this->getEntityEndpointUri($entity->getPreviousRatePlanRevision()->id()) . '/revision', $payload);
+ $response = $this->getClient()->post((string) $this->getEntityEndpointUri($entity->getPreviousRatePlanRevision()->id()) . '/revision', $payload);
$this->getEntitySerializer()->setPropertiesFromResponse($response, $entity);
}
diff --git a/src/Api/Monetization/Denormalizer/AcceptedRatePlanDenormalizer.php b/src/Api/Monetization/Denormalizer/AcceptedRatePlanDenormalizer.php
index f20502a68..a1ca8f083 100644
--- a/src/Api/Monetization/Denormalizer/AcceptedRatePlanDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/AcceptedRatePlanDenormalizer.php
@@ -52,6 +52,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return AcceptedRatePlanInterface::class === $type || $type instanceof AcceptedRatePlanInterface || in_array(AcceptedRatePlanInterface::class, class_implements($type));
+ return AcceptedRatePlanInterface::class === $type || $type instanceof AcceptedRatePlanInterface || in_array(AcceptedRatePlanInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/Monetization/Denormalizer/ApiPackageDenormalizer.php b/src/Api/Monetization/Denormalizer/ApiPackageDenormalizer.php
index 2eaa8ec66..806ef5715 100644
--- a/src/Api/Monetization/Denormalizer/ApiPackageDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/ApiPackageDenormalizer.php
@@ -52,6 +52,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return ApiPackageInterface::class === $type || $type instanceof ApiPackageInterface || in_array(ApiPackageInterface::class, class_implements($type));
+ return ApiPackageInterface::class === $type || $type instanceof ApiPackageInterface || in_array(ApiPackageInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/Monetization/Denormalizer/BalanceDenormalizer.php b/src/Api/Monetization/Denormalizer/BalanceDenormalizer.php
index c3dbae56d..a1c667da2 100644
--- a/src/Api/Monetization/Denormalizer/BalanceDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/BalanceDenormalizer.php
@@ -52,6 +52,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return BalanceInterface::class === $type || $type instanceof BalanceInterface || in_array(BalanceInterface::class, class_implements($type));
+ return BalanceInterface::class === $type || $type instanceof BalanceInterface || in_array(BalanceInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/Monetization/Denormalizer/LegalEntityDenormalizer.php b/src/Api/Monetization/Denormalizer/LegalEntityDenormalizer.php
index b60682b84..064b83a75 100644
--- a/src/Api/Monetization/Denormalizer/LegalEntityDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/LegalEntityDenormalizer.php
@@ -68,9 +68,9 @@ public function denormalize($data, $type, $format = null, array $context = []):
{
if ($data->isCompany) {
return parent::denormalize($data, $this->companyClass, $format, $context);
- } else {
- return parent::denormalize($data, $this->developerClass, $format, $context);
}
+
+ return parent::denormalize($data, $this->developerClass, $format, $context);
}
/**
@@ -83,6 +83,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return LegalEntityInterface::class === $type || $type instanceof LegalEntityInterface || in_array(LegalEntityInterface::class, class_implements($type));
+ return LegalEntityInterface::class === $type || $type instanceof LegalEntityInterface || in_array(LegalEntityInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/Monetization/Denormalizer/OrganizationProfileDenormalizer.php b/src/Api/Monetization/Denormalizer/OrganizationProfileDenormalizer.php
index 49ff8e46c..dcaa78a09 100644
--- a/src/Api/Monetization/Denormalizer/OrganizationProfileDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/OrganizationProfileDenormalizer.php
@@ -52,6 +52,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return OrganizationProfileInterface::class === $type || $type instanceof OrganizationProfileInterface || in_array(OrganizationProfileInterface::class, class_implements($type));
+ return OrganizationProfileInterface::class === $type || $type instanceof OrganizationProfileInterface || in_array(OrganizationProfileInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/Monetization/Denormalizer/PrepaidBalanceDenormalizer.php b/src/Api/Monetization/Denormalizer/PrepaidBalanceDenormalizer.php
index 17a5a0de8..f70f1a034 100644
--- a/src/Api/Monetization/Denormalizer/PrepaidBalanceDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/PrepaidBalanceDenormalizer.php
@@ -52,6 +52,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return PrepaidBalanceInterface::class === $type || $type instanceof PrepaidBalanceInterface || in_array(PrepaidBalanceInterface::class, class_implements($type));
+ return PrepaidBalanceInterface::class === $type || $type instanceof PrepaidBalanceInterface || in_array(PrepaidBalanceInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/Monetization/Denormalizer/RatePlanDenormalizer.php b/src/Api/Monetization/Denormalizer/RatePlanDenormalizer.php
index ac4041eb2..54fc2e420 100644
--- a/src/Api/Monetization/Denormalizer/RatePlanDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/RatePlanDenormalizer.php
@@ -74,6 +74,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return RatePlanInterface::class === $type || $type instanceof RatePlanInterface || in_array(RatePlanInterface::class, class_implements($type));
+ return RatePlanInterface::class === $type || $type instanceof RatePlanInterface || in_array(RatePlanInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/Monetization/Denormalizer/ReportDefinitionDenormalizer.php b/src/Api/Monetization/Denormalizer/ReportDefinitionDenormalizer.php
index d7f40bd95..d13d3faf0 100644
--- a/src/Api/Monetization/Denormalizer/ReportDefinitionDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/ReportDefinitionDenormalizer.php
@@ -52,6 +52,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return ReportDefinitionInterface::class === $type || $type instanceof ReportDefinitionInterface || in_array(ReportDefinitionInterface::class, class_implements($type));
+ return ReportDefinitionInterface::class === $type || $type instanceof ReportDefinitionInterface || in_array(ReportDefinitionInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/Monetization/Denormalizer/SupportedCurrencyDenormalizer.php b/src/Api/Monetization/Denormalizer/SupportedCurrencyDenormalizer.php
index 66d1510e6..3af165a0f 100644
--- a/src/Api/Monetization/Denormalizer/SupportedCurrencyDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/SupportedCurrencyDenormalizer.php
@@ -52,6 +52,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return SupportedCurrencyInterface::class === $type || $type instanceof SupportedCurrencyInterface || in_array(SupportedCurrencyInterface::class, class_implements($type));
+ return SupportedCurrencyInterface::class === $type || $type instanceof SupportedCurrencyInterface || in_array(SupportedCurrencyInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/Monetization/Denormalizer/TermsAndConditionsDenormalizer.php b/src/Api/Monetization/Denormalizer/TermsAndConditionsDenormalizer.php
index df9318853..0e6411adb 100644
--- a/src/Api/Monetization/Denormalizer/TermsAndConditionsDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/TermsAndConditionsDenormalizer.php
@@ -71,6 +71,6 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return TermsAndConditionsInterface::class === $type || $type instanceof TermsAndConditionsInterface || in_array(TermsAndConditionsInterface::class, class_implements($type));
+ return TermsAndConditionsInterface::class === $type || $type instanceof TermsAndConditionsInterface || in_array(TermsAndConditionsInterface::class, class_implements($type) ?: []);
}
}
diff --git a/src/Api/Monetization/Normalizer/AcceptedRatePlanNormalizer.php b/src/Api/Monetization/Normalizer/AcceptedRatePlanNormalizer.php
index 6267b12b3..5b9efe964 100644
--- a/src/Api/Monetization/Normalizer/AcceptedRatePlanNormalizer.php
+++ b/src/Api/Monetization/Normalizer/AcceptedRatePlanNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface;
use Apigee\Edge\Api\Monetization\Utility\TimezoneFixerHelperTrait;
+use ArrayObject;
class AcceptedRatePlanNormalizer extends EntityNormalizer
{
@@ -31,7 +32,7 @@ class AcceptedRatePlanNormalizer extends EntityNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var AcceptedRatePlanInterface $data */
/** @var object $normalized */
diff --git a/src/Api/Monetization/Normalizer/ApiPackageNormalizer.php b/src/Api/Monetization/Normalizer/ApiPackageNormalizer.php
index 2f52fc21d..07c6d69a9 100644
--- a/src/Api/Monetization/Normalizer/ApiPackageNormalizer.php
+++ b/src/Api/Monetization/Normalizer/ApiPackageNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\Monetization\Entity\ApiPackageInterface;
use Apigee\Edge\Api\Monetization\NameConverter\ApiPackageNameConverter;
+use ArrayObject;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -47,7 +48,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
$normalized = (array) parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/CompanyPaymentTransactionNormalizer.php b/src/Api/Monetization/Normalizer/CompanyPaymentTransactionNormalizer.php
index aa4c49c9d..d8ec88413 100644
--- a/src/Api/Monetization/Normalizer/CompanyPaymentTransactionNormalizer.php
+++ b/src/Api/Monetization/Normalizer/CompanyPaymentTransactionNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\Monetization\NameConverter\CompanyRatePlanNameConverter;
use Apigee\Edge\Api\Monetization\Structure\CompanyPaymentTransaction;
+use ArrayObject;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -47,7 +48,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php b/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php
index 20ecce818..2e4cb6bab 100644
--- a/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php
+++ b/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php
@@ -18,6 +18,7 @@
namespace Apigee\Edge\Api\Monetization\Normalizer;
+use ArrayObject;
use DateTimeZone;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@@ -26,7 +27,7 @@ class DateTimeZoneNormalizer implements NormalizerInterface
/**
* {@inheritdoc}
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
return $data->getName();
}
diff --git a/src/Api/Monetization/Normalizer/DeveloperCategoryRatePlanNormalizer.php b/src/Api/Monetization/Normalizer/DeveloperCategoryRatePlanNormalizer.php
index cff66428d..bf2647b16 100644
--- a/src/Api/Monetization/Normalizer/DeveloperCategoryRatePlanNormalizer.php
+++ b/src/Api/Monetization/Normalizer/DeveloperCategoryRatePlanNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\Monetization\Entity\DeveloperCategoryRatePlanInterface;
use Apigee\Edge\Api\Monetization\Entity\RatePlanInterface;
+use ArrayObject;
class DeveloperCategoryRatePlanNormalizer extends RatePlanNormalizer
{
@@ -29,7 +30,7 @@ class DeveloperCategoryRatePlanNormalizer extends RatePlanNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/DeveloperPaymentTransactionNormalizer.php b/src/Api/Monetization/Normalizer/DeveloperPaymentTransactionNormalizer.php
index f5f5c48e9..327e9b4dc 100644
--- a/src/Api/Monetization/Normalizer/DeveloperPaymentTransactionNormalizer.php
+++ b/src/Api/Monetization/Normalizer/DeveloperPaymentTransactionNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Api\Monetization\Normalizer;
use Apigee\Edge\Api\Monetization\Structure\DeveloperPaymentTransaction;
+use ArrayObject;
class DeveloperPaymentTransactionNormalizer extends PaymentTransactionNormalizer
{
@@ -28,7 +29,7 @@ class DeveloperPaymentTransactionNormalizer extends PaymentTransactionNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/EntityNormalizer.php b/src/Api/Monetization/Normalizer/EntityNormalizer.php
index 7ce1480af..eb2534b47 100644
--- a/src/Api/Monetization/Normalizer/EntityNormalizer.php
+++ b/src/Api/Monetization/Normalizer/EntityNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\Monetization\Structure\NestedObjectReferenceInterface;
use Apigee\Edge\Normalizer\ObjectNormalizer;
+use ArrayObject;
use ReflectionObject;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
@@ -63,7 +64,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
* @psalm-suppress InvalidReturnType stdClass is also an object.
* @psalm-suppress InvalidPropertyFetch.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
$normalized = (array) parent::normalize($data, $format, $context);
@@ -127,7 +128,6 @@ protected function getNestedObjectProperties($object): array
$entityReferenceProperties = [];
$ro = new ReflectionObject($object);
foreach ($ro->getProperties() as $property) {
- $property->setAccessible(true);
$value = $property->getValue($object);
if (is_object($value) && $value instanceof NestedObjectReferenceInterface) {
if ($this->nameConverter) {
diff --git a/src/Api/Monetization/Normalizer/LegalEntityNormalizer.php b/src/Api/Monetization/Normalizer/LegalEntityNormalizer.php
index b7a075376..2920f5097 100644
--- a/src/Api/Monetization/Normalizer/LegalEntityNormalizer.php
+++ b/src/Api/Monetization/Normalizer/LegalEntityNormalizer.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Api\Monetization\Entity\DeveloperInterface;
use Apigee\Edge\Api\Monetization\Entity\LegalEntityInterface;
use Apigee\Edge\Api\Monetization\NameConverter\LegalEntityNameConvert;
+use ArrayObject;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -49,7 +50,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/LegalEntityRatePlanNormalizer.php b/src/Api/Monetization/Normalizer/LegalEntityRatePlanNormalizer.php
index edd52da28..c588c485f 100644
--- a/src/Api/Monetization/Normalizer/LegalEntityRatePlanNormalizer.php
+++ b/src/Api/Monetization/Normalizer/LegalEntityRatePlanNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Api\Monetization\Normalizer;
use Apigee\Edge\Api\Monetization\Entity\RatePlanInterface;
+use ArrayObject;
abstract class LegalEntityRatePlanNormalizer extends RatePlanNormalizer
{
@@ -28,7 +29,7 @@ abstract class LegalEntityRatePlanNormalizer extends RatePlanNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/LegalEntityReportDefinitionNormalizer.php b/src/Api/Monetization/Normalizer/LegalEntityReportDefinitionNormalizer.php
index 34e9a6616..5fbd9bb64 100644
--- a/src/Api/Monetization/Normalizer/LegalEntityReportDefinitionNormalizer.php
+++ b/src/Api/Monetization/Normalizer/LegalEntityReportDefinitionNormalizer.php
@@ -18,6 +18,7 @@
namespace Apigee\Edge\Api\Monetization\Normalizer;
+use ArrayObject;
abstract class LegalEntityReportDefinitionNormalizer extends ReportDefinitionNormalizer
{
@@ -27,7 +28,7 @@ abstract class LegalEntityReportDefinitionNormalizer extends ReportDefinitionNor
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/RatePlanNormalizer.php b/src/Api/Monetization/Normalizer/RatePlanNormalizer.php
index 0d1cf5755..716a91f0d 100644
--- a/src/Api/Monetization/Normalizer/RatePlanNormalizer.php
+++ b/src/Api/Monetization/Normalizer/RatePlanNormalizer.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Api\Monetization\NameConverter\RatePlanNameConverter;
use Apigee\Edge\Api\Monetization\Utility\TimezoneFixerHelperTrait;
use Apigee\Edge\Exception\UninitializedPropertyException;
+use ArrayObject;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -51,7 +52,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php b/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php
index de824cbaa..25562cee0 100644
--- a/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php
+++ b/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php
@@ -18,6 +18,7 @@
namespace Apigee\Edge\Api\Monetization\Normalizer;
+use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\SerializerAwareInterface;
use Symfony\Component\Serializer\SerializerAwareTrait;
@@ -53,7 +54,7 @@ public function __construct(array $normalizers = [])
* @psalm-suppress InvalidNullableReturnType - There are going to be at
* least one normalizer always that can normalize data here.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
foreach ($this->normalizers as $normalizer) {
// Return the result from the first denormalizer that can
diff --git a/src/Api/Monetization/Normalizer/RatePlanRateNormalizer.php b/src/Api/Monetization/Normalizer/RatePlanRateNormalizer.php
index 0b98473ac..af2a0a07d 100644
--- a/src/Api/Monetization/Normalizer/RatePlanRateNormalizer.php
+++ b/src/Api/Monetization/Normalizer/RatePlanRateNormalizer.php
@@ -21,6 +21,7 @@
use Apigee\Edge\Api\Monetization\Structure\RatePlanRate;
use Apigee\Edge\Api\Monetization\Structure\RatePlanRateRevShare;
use Apigee\Edge\Normalizer\ObjectNormalizer;
+use ArrayObject;
class RatePlanRateNormalizer extends ObjectNormalizer
{
@@ -30,7 +31,7 @@ class RatePlanRateNormalizer extends ObjectNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/ReportCriteriaNormalizer.php b/src/Api/Monetization/Normalizer/ReportCriteriaNormalizer.php
index c8278ac17..80fdeaf04 100644
--- a/src/Api/Monetization/Normalizer/ReportCriteriaNormalizer.php
+++ b/src/Api/Monetization/Normalizer/ReportCriteriaNormalizer.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\AbstractCriteria;
use Apigee\Edge\Api\Monetization\Utility\TimezoneFixerHelperTrait;
use Apigee\Edge\Normalizer\ObjectNormalizer;
+use ArrayObject;
use DateTimeZone;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
@@ -59,7 +60,7 @@ public function __construct(string $organization, ?ClassMetadataFactoryInterface
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/ReportDefinitionNormalizer.php b/src/Api/Monetization/Normalizer/ReportDefinitionNormalizer.php
index 3b1acb3e1..6d8601e27 100644
--- a/src/Api/Monetization/Normalizer/ReportDefinitionNormalizer.php
+++ b/src/Api/Monetization/Normalizer/ReportDefinitionNormalizer.php
@@ -21,6 +21,7 @@
use Apigee\Edge\Api\Monetization\Entity\ReportDefinitionInterface;
use Apigee\Edge\Api\Monetization\NameConverter\ReportDefinitionNameConverter;
use Apigee\Edge\Api\Monetization\Utility\ReportTypeFromCriteriaHelperTrait;
+use ArrayObject;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -50,7 +51,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var ReportDefinitionInterface $data */
/** @var object $normalized */
diff --git a/src/Api/Monetization/Normalizer/StandardRatePlanNormalizer.php b/src/Api/Monetization/Normalizer/StandardRatePlanNormalizer.php
index a0d4a4353..27faffde6 100644
--- a/src/Api/Monetization/Normalizer/StandardRatePlanNormalizer.php
+++ b/src/Api/Monetization/Normalizer/StandardRatePlanNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\Monetization\Entity\RatePlanInterface;
use Apigee\Edge\Api\Monetization\Entity\StandardRatePlanInterface;
+use ArrayObject;
class StandardRatePlanNormalizer extends RatePlanNormalizer
{
@@ -29,7 +30,7 @@ class StandardRatePlanNormalizer extends RatePlanNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/TermsAndConditionsNormalizer.php b/src/Api/Monetization/Normalizer/TermsAndConditionsNormalizer.php
index 7c28dbc92..fb17e5340 100644
--- a/src/Api/Monetization/Normalizer/TermsAndConditionsNormalizer.php
+++ b/src/Api/Monetization/Normalizer/TermsAndConditionsNormalizer.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Api\Monetization\NameConverter\TermsAndConditionsNameConverter;
use Apigee\Edge\Api\Monetization\Utility\TimezoneFixerHelperTrait;
use Apigee\Edge\Exception\UninitializedPropertyException;
+use ArrayObject;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -51,7 +52,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($data, $format, $context);
diff --git a/src/Api/Monetization/Utility/TimezoneFixerHelperTrait.php b/src/Api/Monetization/Utility/TimezoneFixerHelperTrait.php
index 5fdc04e80..e89620cdb 100644
--- a/src/Api/Monetization/Utility/TimezoneFixerHelperTrait.php
+++ b/src/Api/Monetization/Utility/TimezoneFixerHelperTrait.php
@@ -51,7 +51,6 @@ protected function fixTimeZoneOnNormalization($object, $normalized, DateTimeZone
$ro = new ReflectionObject($object);
$dateDenormalizer = new DateTimeNormalizer([DateTimeNormalizer::FORMAT_KEY => EntityInterface::DATE_FORMAT, DateTimeNormalizer::TIMEZONE_KEY => $orgTimezone]);
foreach ($ro->getProperties() as $property) {
- $property->setAccessible(true);
$value = $property->getValue($object);
if ($value instanceof DateTimeImmutable) {
$normalized->{$property->getName()} = $dateDenormalizer->normalize($value, DateTimeImmutable::class);
@@ -86,7 +85,6 @@ protected function fixTimeZoneOnDenormalization($object, $denormalized, DateTime
foreach ($object as $prop_name => $prop_value) {
if ($ro->hasProperty($prop_name)) {
$property = $ro->getProperty($prop_name);
- $property->setAccessible(true);
$value = $property->getValue($denormalized);
if ($value instanceof DateTimeImmutable) {
$property->setValue($denormalized, $dateDenormalizer->denormalize($prop_value, DateTimeImmutable::class));
diff --git a/src/Controller/PaginationHelperTrait.php b/src/Controller/PaginationHelperTrait.php
index 4ceccf8d2..ab9c59ce9 100644
--- a/src/Controller/PaginationHelperTrait.php
+++ b/src/Controller/PaginationHelperTrait.php
@@ -111,11 +111,10 @@ protected function listEntities(?PagerInterface $pager = null, array $query_para
if (OrganizationFeatures::isPaginationAvailable($organization)) {
return $this->listEntitiesWithCps($pager, $query_params, $key_provider);
- } else {
- $this->triggerCpsSimulationNotice($pager);
-
- return $this->listEntitiesWithoutCps($pager, $query_params, $key_provider);
}
+ $this->triggerCpsSimulationNotice($pager);
+
+ return $this->listEntitiesWithoutCps($pager, $query_params, $key_provider);
}
/**
@@ -136,11 +135,10 @@ protected function listEntityIds(?PagerInterface $pager = null, array $query_par
if (OrganizationFeatures::isCpsEnabled($organization)) {
return $this->listEntityIdsWithCps($pager, $query_params);
- } else {
- $this->triggerCpsSimulationNotice($pager);
-
- return $this->listEntityIdsWithoutCps($pager, $query_params);
}
+ $this->triggerCpsSimulationNotice($pager);
+
+ return $this->listEntityIdsWithoutCps($pager, $query_params);
}
/**
@@ -178,46 +176,45 @@ private function listEntitiesWithCps(?PagerInterface $pager = null, array $query
$responseArray = $this->getResultsInRange($pager, $query_params);
// Ignore entity type key from response, ex.: developer,
// apiproduct, etc.
- $responseArray = reset($responseArray);
+ $responseArray = reset($responseArray) ?: [];
return $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
- } else {
- // Pass an empty pager to load all entities.
- $responseArray = $this->getResultsInRange($this->createPager(), $query_params);
- // Ignore entity type key from response, ex.: developer, apiproduct,
- // etc.
- $responseArray = reset($responseArray);
- if (empty($responseArray)) {
- return [];
- }
- $entities = $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
- $lastEntity = end($entities);
- $lastId = $lastEntity->{$key_provider}();
- do {
- $tmp = $this->getResultsInRange($this->createPager(0, $lastId), $query_params);
- // Ignore entity type key from response, ex.: developer,
- // apiproduct, etc.
- $tmp = reset($tmp);
- // Remove the first item from the list because it is the same
- // as the last item of $entities at this moment.
- // Apigee Edge response always starts with the requested entity
- // (startKey).
- array_shift($tmp);
- $tmpEntities = $this->responseArrayToArrayOfEntities((array) $tmp, $key_provider);
-
- if (count($tmpEntities) > 0) {
- // The returned entity array is keyed by entity id which
- // is unique so we can do this.
- $entities += $tmpEntities;
- $lastEntity = end($tmpEntities);
- $lastId = $lastEntity->{$key_provider}();
- } else {
- $lastId = false;
- }
- } while ($lastId);
-
- return $entities;
}
+ // Pass an empty pager to load all entities.
+ $responseArray = $this->getResultsInRange($this->createPager(), $query_params);
+ // Ignore entity type key from response, ex.: developer, apiproduct,
+ // etc.
+ $responseArray = reset($responseArray);
+ if (empty($responseArray)) {
+ return [];
+ }
+ $entities = $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
+ $lastEntity = end($entities);
+ $lastId = $lastEntity->{$key_provider}();
+ do {
+ $tmp = $this->getResultsInRange($this->createPager(0, $lastId), $query_params);
+ // Ignore entity type key from response, ex.: developer,
+ // apiproduct, etc.
+ $tmp = reset($tmp) ?: [];
+ // Remove the first item from the list because it is the same
+ // as the last item of $entities at this moment.
+ // Apigee Edge response always starts with the requested entity
+ // (startKey).
+ array_shift($tmp);
+ $tmpEntities = $this->responseArrayToArrayOfEntities((array) $tmp, $key_provider);
+
+ if (count($tmpEntities) > 0) {
+ // The returned entity array is keyed by entity id which
+ // is unique so we can do this.
+ $entities += $tmpEntities;
+ $lastEntity = end($tmpEntities);
+ $lastId = $lastEntity->{$key_provider}();
+ } else {
+ $lastId = false;
+ }
+ } while ($lastId);
+
+ return $entities;
}
/**
@@ -245,7 +242,7 @@ private function listEntitiesWithoutCps(?PagerInterface $pager = null, array $qu
$response = $this->getClient()->get($uri);
$responseArray = $this->responseToArray($response);
// Ignore entity type key from response, ex.: apiProduct.
- $responseArray = reset($responseArray);
+ $responseArray = reset($responseArray) ?: [];
$entities = $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
@@ -322,30 +319,29 @@ private function listEntityIdsWithCps(?PagerInterface $pager = null, array $quer
$expandCompatibility = str_ends_with($this->getClient()->getEndpoint(), $baseDomain);
if ($pager) {
return $this->getResultsInRange($pager, $query_params, $expandCompatibility);
- } else {
- $ids = $this->getResultsInRange($this->createPager(), $query_params, $expandCompatibility);
- if (empty($ids)) {
- return [];
- }
- $lastId = end($ids);
- do {
- $tmp = $this->getResultsInRange($this->createPager(0, $lastId), $query_params, $expandCompatibility);
- // Remove the first item from the list because it is the same
- // as the current last item of $ids.
- // Apigee Edge response always starts with the requested entity
- // id (startKey).
- array_shift($tmp);
-
- if (count($tmp) > 0) {
- $ids = array_merge($ids, $tmp);
- $lastId = end($tmp);
- } else {
- $lastId = false;
- }
- } while ($lastId);
-
- return $ids;
}
+ $ids = $this->getResultsInRange($this->createPager(), $query_params, $expandCompatibility);
+ if (empty($ids)) {
+ return [];
+ }
+ $lastId = end($ids);
+ do {
+ $tmp = $this->getResultsInRange($this->createPager(0, $lastId), $query_params, $expandCompatibility);
+ // Remove the first item from the list because it is the same
+ // as the current last item of $ids.
+ // Apigee Edge response always starts with the requested entity
+ // id (startKey).
+ array_shift($tmp);
+
+ if (count($tmp) > 0) {
+ $ids = array_merge($ids, $tmp);
+ $lastId = end($tmp);
+ } else {
+ $lastId = false;
+ }
+ } while ($lastId);
+
+ return $ids;
}
/**
@@ -394,7 +390,7 @@ private function simulateCpsPagination(PagerInterface $pager, array $result, ?ar
$array_search_haystack = $array_search_haystack ?? $result;
// If start key is null let's set it to the first key in the
// result just like the API would do.
- $start_key = $pager->getStartKey() ?? reset($array_search_haystack);
+ $start_key = $pager->getStartKey() ?? (reset($array_search_haystack) ?: '');
$offset = array_search($start_key, $array_search_haystack);
// Start key has not been found in the response. Apigee Edge with
// CPS enabled would return an HTTP 404, with error code
diff --git a/src/Denormalizer/CredentialProductDenormalizer.php b/src/Denormalizer/CredentialProductDenormalizer.php
index 98dde4695..795c2d936 100644
--- a/src/Denormalizer/CredentialProductDenormalizer.php
+++ b/src/Denormalizer/CredentialProductDenormalizer.php
@@ -37,7 +37,7 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return CredentialProductInterface::class === $type || $type instanceof CredentialProductInterface || in_array(CredentialProductInterface::class, class_implements($type));
+ return CredentialProductInterface::class === $type || $type instanceof CredentialProductInterface || in_array(CredentialProductInterface::class, class_implements($type) ?: []);
}
/**
diff --git a/src/Denormalizer/KeyValueMapDenormalizer.php b/src/Denormalizer/KeyValueMapDenormalizer.php
index 5ea9c20a7..a31745721 100644
--- a/src/Denormalizer/KeyValueMapDenormalizer.php
+++ b/src/Denormalizer/KeyValueMapDenormalizer.php
@@ -44,7 +44,7 @@ public function supportsDenormalization($data, $type, $format = null, array $con
return false;
}
- return KeyValueMapInterface::class === $type || $type instanceof KeyValueMapInterface || in_array(KeyValueMapInterface::class, class_implements($type));
+ return KeyValueMapInterface::class === $type || $type instanceof KeyValueMapInterface || in_array(KeyValueMapInterface::class, class_implements($type) ?: []);
}
/**
diff --git a/src/HttpClient/Utility/Builder.php b/src/HttpClient/Utility/Builder.php
index 004e443fb..0957851e8 100644
--- a/src/HttpClient/Utility/Builder.php
+++ b/src/HttpClient/Utility/Builder.php
@@ -168,12 +168,10 @@ public function clearPlugins(): void
* Set or remove rebuild flag from the client.
*
* @param bool $rebuild
- *
- * @return bool
*/
- private function needsRebuild(bool $rebuild = true): bool
+ private function needsRebuild(bool $rebuild = true): void
{
- return $this->rebuild = $rebuild;
+ $this->rebuild = $rebuild;
}
/**
diff --git a/src/Normalizer/CredentialProductNormalizer.php b/src/Normalizer/CredentialProductNormalizer.php
index 5c35d928e..885b0f5bf 100644
--- a/src/Normalizer/CredentialProductNormalizer.php
+++ b/src/Normalizer/CredentialProductNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Normalizer;
use Apigee\Edge\Structure\CredentialProductInterface;
+use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
@@ -32,7 +33,7 @@ class CredentialProductNormalizer implements NormalizerInterface
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/* @var \Apigee\Edge\Structure\CredentialProductInterface $data */
$asObject = [
@@ -42,7 +43,7 @@ public function normalize($data, $format = null, array $context = []): array|str
// Need to convert to \ArrayObject as symfony normalizer throws error for std object.
// Need to set ARRAY_AS_PROPS flag as we need Entries to be accessed as properties.
- return new \ArrayObject($asObject, \ArrayObject::ARRAY_AS_PROPS);
+ return new ArrayObject($asObject, ArrayObject::ARRAY_AS_PROPS);
}
/**
diff --git a/src/Normalizer/EdgeDateNormalizer.php b/src/Normalizer/EdgeDateNormalizer.php
index a06e96767..fd05f3635 100644
--- a/src/Normalizer/EdgeDateNormalizer.php
+++ b/src/Normalizer/EdgeDateNormalizer.php
@@ -18,6 +18,7 @@
namespace Apigee\Edge\Normalizer;
+use ArrayObject;
use DateTimeInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@@ -34,7 +35,7 @@ public function supportsNormalization($data, $format = null, array $context = []
/**
* {@inheritdoc}
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
/* @var \DateTimeInterface $data */
return $data->getTimestamp() * 1000;
diff --git a/src/Normalizer/KeyValueMapNormalizer.php b/src/Normalizer/KeyValueMapNormalizer.php
index c271b823a..1e71d4cd2 100644
--- a/src/Normalizer/KeyValueMapNormalizer.php
+++ b/src/Normalizer/KeyValueMapNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Normalizer;
use Apigee\Edge\Structure\KeyValueMapInterface;
+use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
@@ -29,7 +30,7 @@ class KeyValueMapNormalizer implements NormalizerInterface
/**
* {@inheritdoc}
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
$return = [];
foreach ($data->values() as $key => $value) {
diff --git a/src/Normalizer/ObjectNormalizer.php b/src/Normalizer/ObjectNormalizer.php
index 6d277dbe8..263618b6a 100644
--- a/src/Normalizer/ObjectNormalizer.php
+++ b/src/Normalizer/ObjectNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Normalizer;
use Apigee\Edge\PropertyAccess\PropertyAccessorDecorator;
+use ArrayObject;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
@@ -93,7 +94,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
* @psalm-suppress PossiblyInvalidArgument First argument of array_filter is always an array.
* @psalm-suppress PossiblyNullArgument First argument of array_filter is always an array.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
$asArray = $this->objectNormalizer->normalize($data, $this->format, $context);
// Exclude null values from the output, even if PATCH is not supported on Apigee Edge
@@ -129,10 +130,10 @@ public function setSerializer(SerializerInterface $serializer): void
/**
* {@inheritDoc}
*/
- public function convertToArrayObject($normalized, $array_as_props = \ArrayObject::ARRAY_AS_PROPS)
+ public function convertToArrayObject($normalized, $array_as_props = ArrayObject::ARRAY_AS_PROPS)
{
// default set ARRAY_AS_PROPS flag as we need entries to be accessed as properties.
- return new \ArrayObject($normalized, $array_as_props);
+ return new ArrayObject($normalized, $array_as_props);
}
/**
diff --git a/src/Normalizer/PropertiesPropertyNormalizer.php b/src/Normalizer/PropertiesPropertyNormalizer.php
index dfd41bcd0..0023ca36e 100644
--- a/src/Normalizer/PropertiesPropertyNormalizer.php
+++ b/src/Normalizer/PropertiesPropertyNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Normalizer;
use Apigee\Edge\Structure\PropertiesProperty;
+use ArrayObject;
/**
* Class PropertiesPropertyNormalizer.
@@ -33,7 +34,7 @@ class PropertiesPropertyNormalizer extends KeyValueMapNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
$return = [
'property' => parent::normalize($data, $format, $context),
@@ -41,7 +42,7 @@ public function normalize($data, $format = null, array $context = []): array|str
// convert to \ArrayObject as symfony normalizer throws error for std object.
// set ARRAY_AS_PROPS flag as we need entries to be accessed as properties.
- return new \ArrayObject($return, \ArrayObject::ARRAY_AS_PROPS);
+ return new ArrayObject($return, ArrayObject::ARRAY_AS_PROPS);
}
/**
diff --git a/src/PropertyAccess/PropertyAccessorDecorator.php b/src/PropertyAccess/PropertyAccessorDecorator.php
index 596e9bfa1..c3ac294b1 100644
--- a/src/PropertyAccess/PropertyAccessorDecorator.php
+++ b/src/PropertyAccess/PropertyAccessorDecorator.php
@@ -155,7 +155,6 @@ private static function processTypeErrorOnGetValue($object, string $property, Ty
if (false !== $pos) {
$ro = new ReflectionObject($object);
$rp = $ro->getProperty($property);
- $rp->setAccessible(true);
$pos += strlen($delim);
$actualValue = $rp->getValue($object);
$expectedType = substr($error->getMessage(), $pos, (int) strpos($error->getMessage(), ',', $pos) - $pos);
diff --git a/src/Serializer/EntitySerializer.php b/src/Serializer/EntitySerializer.php
index ea255a156..b532dd7b9 100755
--- a/src/Serializer/EntitySerializer.php
+++ b/src/Serializer/EntitySerializer.php
@@ -25,6 +25,7 @@
use Apigee\Edge\Normalizer\EdgeDateNormalizer;
use Apigee\Edge\Normalizer\KeyValueMapNormalizer;
use Apigee\Edge\Normalizer\ObjectNormalizer;
+use ArrayObject;
use Psr\Http\Message\ResponseInterface;
use ReflectionMethod;
use ReflectionObject;
@@ -90,7 +91,7 @@ public function supportsDenormalization($data, $type, $format = null, array $con
/**
* {@inheritdoc}
*/
- public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
+ public function normalize($data, $format = null, array $context = []): array|string|int|float|bool|ArrayObject|null
{
return $this->serializer->normalize($data, $format, $context);
}
diff --git a/src/Structure/KeyValueMapInterface.php b/src/Structure/KeyValueMapInterface.php
index e5ee22dc1..e6f6c1685 100644
--- a/src/Structure/KeyValueMapInterface.php
+++ b/src/Structure/KeyValueMapInterface.php
@@ -23,7 +23,7 @@
/**
* Interface KeyValueMapInterface.
*
- * @extends \IteratorAggregate
+ * @extends IteratorAggregate
*/
interface KeyValueMapInterface extends IteratorAggregate
{
diff --git a/src/Structure/ObjectCopyHelperTrait.php b/src/Structure/ObjectCopyHelperTrait.php
index 2958e8622..6f60cbc8e 100644
--- a/src/Structure/ObjectCopyHelperTrait.php
+++ b/src/Structure/ObjectCopyHelperTrait.php
@@ -31,7 +31,6 @@ public function __clone()
{
$ro = new ReflectionObject($this);
foreach ($ro->getProperties() as $property) {
- $property->setAccessible(true);
$value = $property->getValue($this);
if (is_object($value)) {
$property->setValue($this, clone $value);
diff --git a/tests/Api/ApigeeX/Controller/PrepaidBalanceControllerTestBase.php b/tests/Api/ApigeeX/Controller/PrepaidBalanceControllerTestBase.php
index 9689119e6..8fadfbcfc 100644
--- a/tests/Api/ApigeeX/Controller/PrepaidBalanceControllerTestBase.php
+++ b/tests/Api/ApigeeX/Controller/PrepaidBalanceControllerTestBase.php
@@ -90,10 +90,8 @@ public function testGetPrepaidBalance(): void
// We need to prepaid balance serializer from the controller.
$ro = new ReflectionObject(static::entityController());
$property = $ro->getProperty('decorated');
- $property->setAccessible(true);
$ro = new ReflectionObject($property->getValue(static::entityController()));
$rp = $ro->getProperty('prepaidBalanceSerializer');
- $rp->setAccessible(true);
$validator = new PrepaidBalanceSerializerValidator($rp->getValue($property->getValue(static::entityController())));
foreach ($entities as $entity) {
diff --git a/tests/Api/Monetization/Controller/PrepaidBalanceControllerTestBase.php b/tests/Api/Monetization/Controller/PrepaidBalanceControllerTestBase.php
index 0cf1aa440..58bde1029 100644
--- a/tests/Api/Monetization/Controller/PrepaidBalanceControllerTestBase.php
+++ b/tests/Api/Monetization/Controller/PrepaidBalanceControllerTestBase.php
@@ -105,10 +105,8 @@ public function testGetPrepaidBalance(): void
// We need to prepaid balance serializer from the controller.
$ro = new ReflectionObject(static::entityController());
$property = $ro->getProperty('decorated');
- $property->setAccessible(true);
$ro = new ReflectionObject($property->getValue(static::entityController()));
$rp = $ro->getProperty('prepaidBalanceSerializer');
- $rp->setAccessible(true);
$validator = new PrepaidBalanceSerializerValidator($rp->getValue($property->getValue(static::entityController())));
foreach ($entities as $entity) {
$validator->validate($json[$i], $entity);
diff --git a/tests/Api/Monetization/Controller/TimezoneConversionTestTrait.php b/tests/Api/Monetization/Controller/TimezoneConversionTestTrait.php
index 431dabc81..aefeaf5a4 100644
--- a/tests/Api/Monetization/Controller/TimezoneConversionTestTrait.php
+++ b/tests/Api/Monetization/Controller/TimezoneConversionTestTrait.php
@@ -111,7 +111,6 @@ private function getDateProperties(EntityInterface $entity): array
$ro = new ReflectionObject($entity);
foreach ($ro->getProperties() as $property) {
- $property->setAccessible(true);
$value = $property->getValue($entity);
if ($value instanceof DateTimeInterface) {
$properties[] = $property->getName();
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/PaymentTransactionPropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/PaymentTransactionPropertyValidator.php
index bff7b681e..0d6749527 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/PaymentTransactionPropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/PaymentTransactionPropertyValidator.php
@@ -84,7 +84,6 @@ public function validate(stdClass $input, stdClass $output, EntityInterface $ent
unset($expected->organization);
$ro = new ReflectionObject($lentity);
$orgProp = $ro->getProperty('organization');
- $orgProp->setAccessible(true);
// Only way to clear organization.
$orgProp->setValue($lentity, null);
// These properties are missing (not returned by Apigee Edge) on a
diff --git a/tests/PropertyAccess/PropertyAccessorDecoratorTest.php b/tests/PropertyAccess/PropertyAccessorDecoratorTest.php
index 2cdf22a89..0fec63638 100644
--- a/tests/PropertyAccess/PropertyAccessorDecoratorTest.php
+++ b/tests/PropertyAccess/PropertyAccessorDecoratorTest.php
@@ -31,6 +31,10 @@
use Symfony\Component\PropertyAccess\Tests\PropertyAccessorTest;
use TypeError;
+if (!class_exists(PropertyAccessorTest::class)) {
+ return;
+}
+
class PropertyAccessorDecoratorTest extends PropertyAccessorTest
{
use PhpUnitBcBridgeTrait;
@@ -124,7 +128,6 @@ protected function setUp(): void
// class.
$ro = new ReflectionClass(PropertyAccessorTest::class);
$property = $ro->getProperty('propertyAccessor');
- $property->setAccessible(true);
$property->setValue($this, $this->propertyAccessor);
}
@@ -412,11 +415,14 @@ public function testIsReadableWithAsymmetricVisibility(): void
parent::testIsReadableWithAsymmetricVisibility();
}
- public function testSetValueWithAsymmetricVisibility(string $propertyPath = '', ?string $expectedException = null): void
+ /**
+ * @dataProvider Symfony\Component\PropertyAccess\Tests\PropertyAccessorTest::setValueWithAsymmetricVisibilityDataProvider
+ */
+ public function testSetValueWithAsymmetricVisibility(string $propertyPath, ?string $expectedException): void
{
if (PHP_VERSION_ID < 80400) {
$this->markTestSkipped('Requires PHP 8.4');
}
- parent::testSetValueWithAsymmetricVisibility($propertyPath, $expectedException);
+ parent::testSetValueWithAsymmetricVisibility(...func_get_args());
}
}
diff --git a/tests/Serializer/EntitySerializerTest.php b/tests/Serializer/EntitySerializerTest.php
index fad933293..0775cee85 100644
--- a/tests/Serializer/EntitySerializerTest.php
+++ b/tests/Serializer/EntitySerializerTest.php
@@ -174,9 +174,7 @@ public function testSetPropertiesFromResponseWithValidValues(): void
/** @var ReflectionProperty $originalProperty */
/** @var ReflectionProperty $entityProperty */
$originalProperty = $roOriginal->getProperty('propertyWithoutGetter');
- $originalProperty->setAccessible(true);
$entityProperty = $roEntity->getProperty('propertyWithoutGetter');
- $entityProperty->setAccessible(true);
$this->assertEquals($originalProperty->getValue($original), $entityProperty->getValue($entity));
// Ensure that value of a property that uses variable-length
diff --git a/tests/Test/Controller/EntityControllerTestBase.php b/tests/Test/Controller/EntityControllerTestBase.php
index a7f14d19d..e4e0ed302 100644
--- a/tests/Test/Controller/EntityControllerTestBase.php
+++ b/tests/Test/Controller/EntityControllerTestBase.php
@@ -66,10 +66,8 @@ protected function entitySerializer(): EntitySerializerInterface
// a controller.
$ro = new ReflectionObject(static::entityController());
$property = $ro->getProperty('decorated');
- $property->setAccessible(true);
$ro = new ReflectionObject($property->getValue(static::entityController()));
$rm = $ro->getMethod('getEntitySerializer');
- $rm->setAccessible(true);
static::$instance = $rm->invoke($property->getValue(static::entityController()));
}