Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/php-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 27 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand All @@ -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",
Expand All @@ -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": {
Expand Down
38 changes: 15 additions & 23 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ Copyright 2018 Google LLC
~
Expand All @@ -15,17 +14,15 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.4/phpunit.xsd"
colors="true"
bootstrap="./vendor/autoload.php"
printerClass="LimeDeck\Testing\Printer"
verbose="true">
<php>
<!-- Apigee Edge credentials - uncomment and change these lines to change to an online test. -->
<!--
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" colors="true" bootstrap="./vendor/autoload.php" printerClass="LimeDeck\Testing\Printer" verbose="true">
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<php>
<!-- Apigee Edge credentials - uncomment and change these lines to change to an online test. -->
<!--
<env name="APIGEE_EDGE_PHP_CLIENT_API_CLIENT" value="\Apigee\Edge\Tests\Test\Client"/>
<env name="APIGEE_EDGE_PHP_CLIENT_HTTP_CLIENT" value="\Http\Adapter\Guzzle6\Client"/>
<env name="APIGEE_EDGE_PHP_CLIENT_ORGANIZATION" value="myorg"/>
Expand All @@ -34,15 +31,10 @@
<env name="APIGEE_EDGE_PHP_CLIENT_ENVIRONMENT" value="prod"/>
<env name="APIGEE_EDGE_ENDPOINT" value="https://api.enterprise.apigee.com/v1"/>
-->
</php>
<testsuites>
<testsuite name="All Apigee Edge PHP API Client Tests">
<directory>tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</php>
<testsuites>
<testsuite name="All Apigee Edge PHP API Client Tests">
<directory>tests/</directory>
</testsuite>
</testsuites>
</phpunit>
15 changes: 14 additions & 1 deletion psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>
<projectFiles>
<directory name="src" />
Expand Down Expand Up @@ -54,6 +54,19 @@
<DeprecatedInterface errorLevel="info" />

<RiskyTruthyFalsyComparison errorLevel="info" />

<ClassMustBeFinal errorLevel="info" />
<MissingOverrideAttribute errorLevel="info" />
<PossiblyUnusedMethod errorLevel="info" />
<PossiblyUnusedReturnValue errorLevel="info" />
<PossiblyUnusedParam errorLevel="info" />
<UnusedProperty errorLevel="info" />
<UnusedClass errorLevel="info" />
<UnusedVariable errorLevel="info" />
<UnusedDocblockParam errorLevel="info" />
<UnnecessaryVarAnnotation errorLevel="info" />
<PossiblyUnusedProperty errorLevel="info" />
<UnusedParam errorLevel="info" />

</issueHandlers>
</psalm>
2 changes: 1 addition & 1 deletion src/Api/ApigeeX/Controller/AcceptedRatePlanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Api/ApigeeX/Controller/ApiProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/ApigeeX/Controller/RatePlanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) ?: []);
}
}
2 changes: 1 addition & 1 deletion src/Api/ApigeeX/Denormalizer/ApiProductDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) ?: []);
}
}
2 changes: 1 addition & 1 deletion src/Api/ApigeeX/Denormalizer/AppDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) ?: []);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Api/ApigeeX/Denormalizer/BillingTypeDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) ?: []);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) ?: []);
}
}
2 changes: 1 addition & 1 deletion src/Api/ApigeeX/Denormalizer/RatePlanDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) ?: []);
}
}
4 changes: 2 additions & 2 deletions src/Api/ApigeeX/Entity/Property/NanosPropertyAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Api/ApigeeX/Normalizer/AcceptedRatePlanNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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 */
Expand Down
3 changes: 2 additions & 1 deletion src/Api/ApigeeX/Normalizer/ApiProductNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion src/Api/ApigeeX/Normalizer/AppGroupMembershipNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = [];

Expand Down
3 changes: 2 additions & 1 deletion src/Api/ApigeeX/Normalizer/AppNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

use Apigee\Edge\Api\Management\Entity\AppInterface;
use Apigee\Edge\Normalizer\ObjectNormalizer;
use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

/**
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/Api/ApigeeX/Normalizer/BillingTypeNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

use Apigee\Edge\Api\ApigeeX\Entity\BillingTypeInterface;
use Apigee\Edge\Api\Monetization\Normalizer\EntityNormalizer;
use ArrayObject;

class BillingTypeNormalizer extends EntityNormalizer
{
Expand All @@ -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 */
Expand Down
3 changes: 2 additions & 1 deletion src/Api/ApigeeX/Normalizer/RatePlanNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/Api/ApigeeX/Normalizer/RatePlanRateNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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);
Expand Down
Loading
Loading