diff --git a/composer.json b/composer.json index 0fc0a13bb..d5a264482 100644 --- a/composer.json +++ b/composer.json @@ -28,9 +28,9 @@ "php-http/message-factory": "^1.0", "phpdocumentor/reflection-docblock": "^5.0", "psr/http-message": "^1.0 || ^2.0", - "symfony/options-resolver": "^7.3.0", - "symfony/property-access": "^7.3.0", - "symfony/property-info": "^7.3.0", + "symfony/options-resolver": "^7.4.0", + "symfony/property-access": "^7.4.4", + "symfony/property-info": "^7.4.0", "symfony/serializer": "^7.3.0" }, "require-dev": { diff --git a/src/PropertyAccess/PropertyAccessorDecorator.php b/src/PropertyAccess/PropertyAccessorDecorator.php index e47653fa6..596e9bfa1 100644 --- a/src/PropertyAccess/PropertyAccessorDecorator.php +++ b/src/PropertyAccess/PropertyAccessorDecorator.php @@ -60,6 +60,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value): void // Auto-retry, try to pass the value as variable-length arguments to // the setter method. if (is_object($objectOrArray) && is_array($value)) { + /** @var object $objectOrArray */ $setter = null; // Support setPropertyName() and propertyName() setters. foreach (['set' . ucfirst((string) $propertyPath), (string) $propertyPath] as $methodName) { diff --git a/tests/Api/Management/Controller/DeveloperControllerTest.php b/tests/Api/Management/Controller/DeveloperControllerTest.php index ed5df367a..c29396d10 100644 --- a/tests/Api/Management/Controller/DeveloperControllerTest.php +++ b/tests/Api/Management/Controller/DeveloperControllerTest.php @@ -7,7 +7,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -36,7 +36,9 @@ use Apigee\Edge\Tests\Test\Controller\MockClientAwareTrait; use Apigee\Edge\Tests\Test\TestClientFactory; use Apigee\Edge\Tests\Test\Utility\MarkOnlineTestSkippedAwareTrait; +use Composer\InstalledVersions; use GuzzleHttp\Psr7\Response; +use stdClass; /** * Class DeveloperControllerTest. @@ -180,4 +182,57 @@ protected static function entityCreateOperationTestController(): EntityCreateOpe { return new EntityCreateOperationControllerTester(static::entityController()); } + + /** + * {@inheritdoc} + */ + protected function alterArraysBeforeCompareSentAndReceivedPayloadsInCreate(array &$sentEntityAsArray, array $responseEntityAsArray): void + { + // Get the version string (e.g., "6.4.12") + $version = InstalledVersions::getVersion('symfony/serializer'); + if (version_compare($version, '7.3.11', '>=')) { + // The originalEmail property is not returned by the API on creation. + unset($sentEntityAsArray['originalEmail']); + } + } + + /** + * {@inheritdoc} + */ + protected function alterObjectsBeforeCompareResponseAndCreatedEntity(stdClass &$responseObject, EntityInterface $created): void + { + $version = InstalledVersions::getVersion('symfony/serializer'); + if (version_compare($version, '7.3.11', '>=')) { + // The originalEmail property is not returned by the API on creation. + if ($created instanceof Developer) { + $responseObject->originalEmail = $created->originalEmail(); + } + } + } + + /** + * {@inheritdoc} + */ + protected function alterArraysBeforeCompareSentAndReceivedPayloadsInUpdate(array &$sentEntityAsArray, array $responseEntityAsArray): void + { + $version = InstalledVersions::getVersion('symfony/serializer'); + if (version_compare($version, '7.3.11', '>=')) { + // The originalEmail property is not returned by the API on update. + unset($sentEntityAsArray['originalEmail']); + } + } + + /** + * {@inheritdoc} + */ + protected function alterObjectsBeforeCompareResponseAndUpdateEntity(stdClass &$responseObject, EntityInterface $updated): void + { + $version = InstalledVersions::getVersion('symfony/serializer'); + if (version_compare($version, '7.3.11', '>=')) { + // The originalEmail property is not returned by the API on update. + if ($updated instanceof Developer) { + $responseObject->originalEmail = $updated->originalEmail(); + } + } + } }