From f0271ea00dc28d8dae91eb9253a4fe32d6cc17a2 Mon Sep 17 00:00:00 2001 From: Shishir <75600200+shishir-intelli@users.noreply.github.com> Date: Fri, 13 Sep 2024 17:38:42 +0530 Subject: [PATCH] Remove symfony/serializer conflict and bump version (#376) --- composer.json | 13 +- .../Reports/Criteria/AbstractCriteria.php | 212 ++++++++++++++++-- .../Reports/Criteria/GroupByCriteriaTrait.php | 17 +- .../TransactionTypesCriteriaTrait.php | 17 +- .../ReportDefinitionEntityProviderTrait.php | 6 +- 5 files changed, 234 insertions(+), 31 deletions(-) diff --git a/composer.json b/composer.json index e5f5e809..d246ba42 100644 --- a/composer.json +++ b/composer.json @@ -28,10 +28,10 @@ "php-http/message-factory": "^1.0", "phpdocumentor/reflection-docblock": "^5.0", "psr/http-message": "^1.0 || ^2.0", - "symfony/options-resolver": "^6.4.6", - "symfony/property-access": "^6.4.6", - "symfony/property-info": "^6.4.6", - "symfony/serializer": "^6.4.6" + "symfony/options-resolver": "^6.4.9", + "symfony/property-access": "^6.4.9", + "symfony/property-info": "^6.4.9", + "symfony/serializer": "^6.4.9" }, "require-dev": { "dms/phpunit-arraysubset-asserts": "^0.4.0", @@ -46,12 +46,9 @@ "phpmetrics/phpmetrics": "^2.7", "phpunit/phpunit": "^9.6", "sebastian/comparator": "^4.0.5", - "symfony/cache": "^6.4.6", + "symfony/cache": "^6.4.9", "vimeo/psalm": "^5.20" }, - "conflict": { - "symfony/serializer": ">6.4.6" - }, "autoload": { "psr-4": { "Apigee\\Edge\\": "src" diff --git a/src/Api/Monetization/Structure/Reports/Criteria/AbstractCriteria.php b/src/Api/Monetization/Structure/Reports/Criteria/AbstractCriteria.php index 5d5ecb4b..2c75f4cb 100644 --- a/src/Api/Monetization/Structure/Reports/Criteria/AbstractCriteria.php +++ b/src/Api/Monetization/Structure/Reports/Criteria/AbstractCriteria.php @@ -23,12 +23,6 @@ /** * Base class for all supported Monetization reports. * - * Boolean getters must be prefixed with "get" instead of "is" because - * property accessor tries to call property name (without prefix) earlier - * than "is" . ucfirst('propertyName') - which is a setter method here. - * - * @see https://github.com/symfony/property-access/blob/v4.2.5/PropertyAccessor.php#L433-L435 - * * @internal * * @see https://docs.apigee.com/api-platform/monetization/create-reports#repdefconfigapi @@ -125,9 +119,24 @@ public function getApps(): array /** * @param string ...$appIds * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function apps(string ...$appIds): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setApps() instead.', E_USER_DEPRECATED); + + return $this->setApps(...$appIds); + } + + /** + * @param string ...$appIds + * + * @return self + */ + public function setApps(string ...$appIds): self { $this->apps = $appIds; @@ -145,9 +154,24 @@ public function getCurrencies(): array /** * @param string ...$currencyIds * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function currencies(string ...$currencyIds): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setCurrencies() instead.', E_USER_DEPRECATED); + + return $this->setCurrencies(...$currencyIds); + } + + /** + * @param string ...$currencyIds + * + * @return self + */ + public function setCurrencies(string ...$currencyIds): self { $this->currencies = $currencyIds; @@ -165,9 +189,26 @@ public function getCurrencyOption(): ?string /** * @param string|null $currencyOption * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function currencyOption(?string $currencyOption): self + { + // This tweak allows to reset the previously configured currency option + // by calling this method with an empty string or null. + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setCurrencyOption() instead.', E_USER_DEPRECATED); + + return $this->setCurrencyOption($currencyOption); + } + + /** + * @param string|null $currencyOption + * + * @return self + */ + public function setCurrencyOption(?string $currencyOption): self { // This tweak allows to reset the previously configured currency option // by calling this method with an empty string or null. @@ -179,9 +220,24 @@ public function currencyOption(?string $currencyOption): self /** * @param string ...$developerIds * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function developers(string ...$developerIds): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setDevelopers() instead.', E_USER_DEPRECATED); + + return $this->setDevelopers(...$developerIds); + } + + /** + * @param string ...$developerIds + * + * @return self + */ + public function setDevelopers(string ...$developerIds): self { $this->developers = $developerIds; @@ -207,9 +263,24 @@ public function getApiPackages(): array /** * @param string ...$apiPackageIds * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function apiPackages(string ...$apiPackageIds): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setApiPackages() instead.', E_USER_DEPRECATED); + + return $this->setApiPackages(...$apiPackageIds); + } + + /** + * @param string ...$apiPackageIds + * + * @return self + */ + public function setApiPackages(string ...$apiPackageIds): self { $this->apiPackages = $apiPackageIds; @@ -227,9 +298,24 @@ public function getApiProducts(): array /** * @param string ...$apiProductIds * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function apiProducts(string ...$apiProductIds): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setApiProducts() instead.', E_USER_DEPRECATED); + + return $this->setApiProducts(...$apiProductIds); + } + + /** + * @param string ...$apiProductIds + * + * @return self + */ + public function setApiProducts(string ...$apiProductIds): self { $this->apiProducts = $apiProductIds; @@ -247,9 +333,24 @@ public function getPricingTypes(): array /** * @param string ...$pricingTypes * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function pricingTypes(string ...$pricingTypes): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setPricingTypes() instead.', E_USER_DEPRECATED); + + return $this->setPricingTypes(...$pricingTypes); + } + + /** + * @param string ...$pricingTypes + * + * @return self + */ + public function setPricingTypes(string ...$pricingTypes): self { $this->pricingTypes = $pricingTypes; @@ -267,9 +368,24 @@ public function getRatePlanLevels(): array /** * @param string ...$ratePlanLevels * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function ratePlanLevels(string ...$ratePlanLevels): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setRatePlanLevels() instead.', E_USER_DEPRECATED); + + return $this->setRatePlanLevels(...$ratePlanLevels); + } + + /** + * @param string ...$ratePlanLevels + * + * @return self + */ + public function setRatePlanLevels(string ...$ratePlanLevels): self { $this->ratePlanLevels = $ratePlanLevels; @@ -311,9 +427,24 @@ public function getShowTransactionType(): bool /** * @param bool $show * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function showRevenueSharePercentage(bool $show): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setShowRevenueSharePercentage() instead.', E_USER_DEPRECATED); + + return $this->setShowRevenueSharePercentage($show); + } + + /** + * @param bool $show + * + * @return self + */ + public function setShowRevenueSharePercentage(bool $show): self { $this->showRevenueSharePercentage = $show; @@ -323,9 +454,24 @@ public function showRevenueSharePercentage(bool $show): self /** * @param bool $show * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function showSummary(bool $show): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setShowSummary() instead.', E_USER_DEPRECATED); + + return $this->setShowSummary($show); + } + + /** + * @param bool $show + * + * @return self + */ + public function setShowSummary(bool $show): self { $this->showSummary = $show; @@ -335,9 +481,24 @@ public function showSummary(bool $show): self /** * @param bool $show * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function showTransactionDetail(bool $show): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setShowTransactionDetail() instead.', E_USER_DEPRECATED); + + return $this->setShowTransactionDetail($show); + } + + /** + * @param bool $show + * + * @return self + */ + public function setShowTransactionDetail(bool $show): self { $this->showTransactionDetail = $show; @@ -347,9 +508,24 @@ public function showTransactionDetail(bool $show): self /** * @param bool $show * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function showTransactionType(bool $show): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setShowTransactionType() instead.', E_USER_DEPRECATED); + + return $this->setShowTransactionType($show); + } + + /** + * @param bool $show + * + * @return self + */ + public function setShowTransactionType(bool $show): self { $this->showTransactionType = $show; diff --git a/src/Api/Monetization/Structure/Reports/Criteria/GroupByCriteriaTrait.php b/src/Api/Monetization/Structure/Reports/Criteria/GroupByCriteriaTrait.php index 3029f372..26a626ab 100644 --- a/src/Api/Monetization/Structure/Reports/Criteria/GroupByCriteriaTrait.php +++ b/src/Api/Monetization/Structure/Reports/Criteria/GroupByCriteriaTrait.php @@ -34,9 +34,24 @@ public function getGroupBy(): array /** * @param string ...$groupBy * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function groupBy(string ...$groupBy): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setGroupBy() instead.', E_USER_DEPRECATED); + + return $this->setGroupBy(...$groupBy); + } + + /** + * @param string ...$groupBy + * + * @return self + */ + public function setGroupBy(string ...$groupBy): self { $this->groupBy = $groupBy; diff --git a/src/Api/Monetization/Structure/Reports/Criteria/TransactionTypesCriteriaTrait.php b/src/Api/Monetization/Structure/Reports/Criteria/TransactionTypesCriteriaTrait.php index c1a074f6..2a323871 100644 --- a/src/Api/Monetization/Structure/Reports/Criteria/TransactionTypesCriteriaTrait.php +++ b/src/Api/Monetization/Structure/Reports/Criteria/TransactionTypesCriteriaTrait.php @@ -36,9 +36,24 @@ public function getTransactionTypes(): array /** * @param string ...$transactionTypes * - * @return \self + * @return self + * + * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed. + * https://github.com/apigee/apigee-client-php/issues/373 */ public function transactionTypes(string ...$transactionTypes): self + { + trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setTransactionTypes() instead.', E_USER_DEPRECATED); + + return $this->setTransactionTypes(...$transactionTypes); + } + + /** + * @param string ...$transactionTypes + * + * @return self + */ + public function setTransactionTypes(string ...$transactionTypes): self { $this->transactionTypes = $transactionTypes; diff --git a/tests/Api/Monetization/Entity/ReportDefinitionEntityProviderTrait.php b/tests/Api/Monetization/Entity/ReportDefinitionEntityProviderTrait.php index c16262ab..b4722e2d 100644 --- a/tests/Api/Monetization/Entity/ReportDefinitionEntityProviderTrait.php +++ b/tests/Api/Monetization/Entity/ReportDefinitionEntityProviderTrait.php @@ -30,7 +30,7 @@ trait ReportDefinitionEntityProviderTrait protected static function getNewReportDefinition(bool $randomData = true): ReportDefinitionInterface { $criteria = new BillingReportCriteria('JANUARY', $randomData ? date('Y') : 2019); - $criteria->groupBy('PACKAGE', 'PRODUCT', 'DEVELOPER')->ratePlanLevels('STANDARD', 'DEVELOPER')->developers('developer@example.com'); + $criteria->setGroupBy('PACKAGE', 'PRODUCT', 'DEVELOPER')->setRatePlanLevels('STANDARD', 'DEVELOPER')->setDevelopers('developer@example.com'); $entity = new ReportDefinition([ 'name' => $randomData ? static::randomGenerator()->machineName() : 'PHPUnit', 'description' => $randomData ? static::randomGenerator()->text() : 'test report definition provider', @@ -44,10 +44,10 @@ protected static function getUpdatedReportDefinition(ReportDefinitionInterface $ { $updated = clone $existing; $updated->setDescription($randomData ? static::randomGenerator()->text() : '(edited) test report definition provider'); - /** @var \Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\BillingReportCriteria $criteria */ + /** @var BillingReportCriteria $criteria */ $criteria = $updated->getCriteria(); $criteria->setBillingMonth('FEBRUARY'); - $criteria->showSummary(!$criteria->getShowSummary()); + $criteria->setShowSummary(!$criteria->getShowSummary()); $updated->setCriteria($criteria); return $updated;