From 523c6d9d8aaa2383362dbc830a365a65e4f7c14a Mon Sep 17 00:00:00 2001 From: divyajose Date: Tue, 3 Oct 2023 16:22:16 +0530 Subject: [PATCH 1/4] Added method getSupportedTypes --- src/Api/ApigeeX/Denormalizer/AppDenormalizer.php | 9 +++++++++ src/Api/ApigeeX/Normalizer/AppNormalizer.php | 9 +++++++++ .../Denormalizer/CompanyMembershipDenormalizer.php | 9 +++++++++ .../Management/Normalizer/AppCredentialNormalizer.php | 9 +++++++++ src/Api/Management/Normalizer/AppNormalizer.php | 9 +++++++++ .../Normalizer/CompanyMembershipNormalizer.php | 9 +++++++++ src/Denormalizer/AttributesPropertyDenormalizer.php | 9 +++++++++ src/Denormalizer/CredentialProductDenormalizer.php | 9 +++++++++ src/Denormalizer/EdgeDateDenormalizer.php | 9 +++++++++ src/Denormalizer/KeyValueMapDenormalizer.php | 9 +++++++++ src/Denormalizer/ObjectDenormalizer.php | 9 +++++++++ src/Denormalizer/PropertiesPropertyDenormalizer.php | 9 +++++++++ src/Normalizer/CredentialProductNormalizer.php | 9 +++++++++ src/Normalizer/EdgeDateNormalizer.php | 9 +++++++++ src/Normalizer/KeyValueMapNormalizer.php | 9 +++++++++ src/Normalizer/ObjectNormalizer.php | 9 +++++++++ 16 files changed, 144 insertions(+) diff --git a/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php b/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php index 147e34f3..96cb7341 100644 --- a/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php +++ b/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php @@ -70,4 +70,13 @@ public function supportsDenormalization($data, $type, $format = null) return AppInterface::class === $type || $type instanceof AppInterface || in_array(AppInterface::class, class_implements($type)); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + AppInterface::class => TRUE, + ]; + } } diff --git a/src/Api/ApigeeX/Normalizer/AppNormalizer.php b/src/Api/ApigeeX/Normalizer/AppNormalizer.php index c17990a6..5c465e82 100644 --- a/src/Api/ApigeeX/Normalizer/AppNormalizer.php +++ b/src/Api/ApigeeX/Normalizer/AppNormalizer.php @@ -54,4 +54,13 @@ public function normalize($object, $format = null, array $context = []) return $normalized; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + AppInterface::class => TRUE, + ]; + } } diff --git a/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php b/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php index 42b3f38a..20b739b7 100755 --- a/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php +++ b/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php @@ -53,4 +53,13 @@ public function supportsDenormalization($data, $type, $format = null) return CompanyMembership::class === $type || $type instanceof CompanyMembership; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + CompanyMembership::class => TRUE, + ]; + } } diff --git a/src/Api/Management/Normalizer/AppCredentialNormalizer.php b/src/Api/Management/Normalizer/AppCredentialNormalizer.php index d841560c..2bdf1c42 100644 --- a/src/Api/Management/Normalizer/AppCredentialNormalizer.php +++ b/src/Api/Management/Normalizer/AppCredentialNormalizer.php @@ -53,4 +53,13 @@ public function normalize($object, $format = null, array $context = []) return $normalized; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + AppCredentialInterface::class => TRUE, + ]; + } } diff --git a/src/Api/Management/Normalizer/AppNormalizer.php b/src/Api/Management/Normalizer/AppNormalizer.php index c5d036d7..bd5a48ae 100644 --- a/src/Api/Management/Normalizer/AppNormalizer.php +++ b/src/Api/Management/Normalizer/AppNormalizer.php @@ -51,4 +51,13 @@ public function normalize($object, $format = null, array $context = []) return $normalized; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + AppInterface::class => TRUE, + ]; + } } diff --git a/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php b/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php index c4f856a9..868477a8 100644 --- a/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php +++ b/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php @@ -51,4 +51,13 @@ public function supportsNormalization($data, $format = null) { return $data instanceof CompanyMembership; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + CompanyMembership::class => TRUE, + ]; + } } diff --git a/src/Denormalizer/AttributesPropertyDenormalizer.php b/src/Denormalizer/AttributesPropertyDenormalizer.php index 90299901..6b01b51c 100644 --- a/src/Denormalizer/AttributesPropertyDenormalizer.php +++ b/src/Denormalizer/AttributesPropertyDenormalizer.php @@ -63,4 +63,13 @@ public function denormalize($data, $type, $format = null, array $context = []) return parent::denormalize($data, $type, $format, $context); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + AttributesProperty::class => TRUE, + ]; + } } diff --git a/src/Denormalizer/CredentialProductDenormalizer.php b/src/Denormalizer/CredentialProductDenormalizer.php index 34dd0440..819d1cfe 100644 --- a/src/Denormalizer/CredentialProductDenormalizer.php +++ b/src/Denormalizer/CredentialProductDenormalizer.php @@ -47,4 +47,13 @@ public function denormalize($data, $type, $format = null, array $context = []) { return new CredentialProduct($data->apiproduct, $data->status); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + CredentialProductInterface::class => TRUE, + ]; + } } diff --git a/src/Denormalizer/EdgeDateDenormalizer.php b/src/Denormalizer/EdgeDateDenormalizer.php index a87dfc61..c698d74c 100644 --- a/src/Denormalizer/EdgeDateDenormalizer.php +++ b/src/Denormalizer/EdgeDateDenormalizer.php @@ -73,4 +73,13 @@ public function supportsDenormalization($data, $type, $format = null) { return isset(self::$supportedTypes[$type]); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + '*' => FALSE, + ]; + } } diff --git a/src/Denormalizer/KeyValueMapDenormalizer.php b/src/Denormalizer/KeyValueMapDenormalizer.php index af17052b..96b5b5bb 100644 --- a/src/Denormalizer/KeyValueMapDenormalizer.php +++ b/src/Denormalizer/KeyValueMapDenormalizer.php @@ -46,4 +46,13 @@ public function supportsDenormalization($data, $type, $format = null) return KeyValueMapInterface::class === $type || $type instanceof KeyValueMapInterface || in_array(KeyValueMapInterface::class, class_implements($type)); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + KeyValueMapInterface::class => TRUE, + ]; + } } diff --git a/src/Denormalizer/ObjectDenormalizer.php b/src/Denormalizer/ObjectDenormalizer.php index 4aaf0200..31715c86 100644 --- a/src/Denormalizer/ObjectDenormalizer.php +++ b/src/Denormalizer/ObjectDenormalizer.php @@ -133,4 +133,13 @@ public function setSerializer(SerializerInterface $serializer): void $this->serializer = $serializer; $this->objectNormalizer->setSerializer($this->serializer); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + '*' => FALSE, + ]; + } } diff --git a/src/Denormalizer/PropertiesPropertyDenormalizer.php b/src/Denormalizer/PropertiesPropertyDenormalizer.php index 9910d712..2f51dd52 100644 --- a/src/Denormalizer/PropertiesPropertyDenormalizer.php +++ b/src/Denormalizer/PropertiesPropertyDenormalizer.php @@ -53,4 +53,13 @@ public function denormalize($data, $type, $format = null, array $context = []) return parent::denormalize($data, $type, $format, $context); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + PropertiesProperty::class => TRUE, + ]; + } } diff --git a/src/Normalizer/CredentialProductNormalizer.php b/src/Normalizer/CredentialProductNormalizer.php index 2f882a70..02e7c934 100644 --- a/src/Normalizer/CredentialProductNormalizer.php +++ b/src/Normalizer/CredentialProductNormalizer.php @@ -52,4 +52,13 @@ public function supportsNormalization($data, $format = null) { return $data instanceof CredentialProductInterface; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + CredentialProductInterface::class => TRUE, + ]; + } } diff --git a/src/Normalizer/EdgeDateNormalizer.php b/src/Normalizer/EdgeDateNormalizer.php index 9443d847..9ebca1f9 100644 --- a/src/Normalizer/EdgeDateNormalizer.php +++ b/src/Normalizer/EdgeDateNormalizer.php @@ -38,4 +38,13 @@ public function normalize($object, $format = null, array $context = []) /* @var \DateTimeInterface $object */ return $object->getTimestamp() * 1000; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + \DateTimeInterface::class => TRUE, + ]; + } } diff --git a/src/Normalizer/KeyValueMapNormalizer.php b/src/Normalizer/KeyValueMapNormalizer.php index 22d7fbd7..93b8e4f1 100644 --- a/src/Normalizer/KeyValueMapNormalizer.php +++ b/src/Normalizer/KeyValueMapNormalizer.php @@ -46,4 +46,13 @@ public function supportsNormalization($data, $format = null) { return $data instanceof KeyValueMapInterface; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + KeyValueMapInterface::class => TRUE, + ]; + } } diff --git a/src/Normalizer/ObjectNormalizer.php b/src/Normalizer/ObjectNormalizer.php index f24e5ce4..0c0ea608 100644 --- a/src/Normalizer/ObjectNormalizer.php +++ b/src/Normalizer/ObjectNormalizer.php @@ -134,4 +134,13 @@ public function convertToArrayObject($normalized, $array_as_props = \ArrayObject //default set ARRAY_AS_PROPS flag as we need entries to be accessed as properties. return new \ArrayObject($normalized, $array_as_props); } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array { + return [ + '*' => FALSE, + ]; + } } From 074951c8c7c581ff8e794a4a3b30006705e1873a Mon Sep 17 00:00:00 2001 From: divyajose Date: Tue, 3 Oct 2023 16:40:30 +0530 Subject: [PATCH 2/4] phpcs fix --- src/Api/ApigeeX/Denormalizer/AppDenormalizer.php | 5 +++-- src/Api/ApigeeX/Normalizer/AppNormalizer.php | 5 +++-- .../Denormalizer/CompanyMembershipDenormalizer.php | 5 +++-- .../Management/Normalizer/AppCredentialNormalizer.php | 5 +++-- src/Api/Management/Normalizer/AppNormalizer.php | 5 +++-- .../Normalizer/CompanyMembershipNormalizer.php | 9 +++++---- src/Denormalizer/AttributesPropertyDenormalizer.php | 5 +++-- src/Denormalizer/CredentialProductDenormalizer.php | 5 +++-- src/Denormalizer/EdgeDateDenormalizer.php | 7 ++++--- src/Denormalizer/KeyValueMapDenormalizer.php | 5 +++-- src/Denormalizer/ObjectDenormalizer.php | 5 +++-- src/Denormalizer/PropertiesPropertyDenormalizer.php | 5 +++-- src/Normalizer/CredentialProductNormalizer.php | 9 +++++---- src/Normalizer/EdgeDateNormalizer.php | 5 +++-- src/Normalizer/KeyValueMapNormalizer.php | 5 +++-- src/Normalizer/ObjectNormalizer.php | 7 ++++--- 16 files changed, 54 insertions(+), 38 deletions(-) diff --git a/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php b/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php index 96cb7341..89e048fc 100644 --- a/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php +++ b/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php @@ -74,9 +74,10 @@ public function supportsDenormalization($data, $type, $format = null) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - AppInterface::class => TRUE, + AppInterface::class => true, ]; } } diff --git a/src/Api/ApigeeX/Normalizer/AppNormalizer.php b/src/Api/ApigeeX/Normalizer/AppNormalizer.php index 5c465e82..3f7b3564 100644 --- a/src/Api/ApigeeX/Normalizer/AppNormalizer.php +++ b/src/Api/ApigeeX/Normalizer/AppNormalizer.php @@ -58,9 +58,10 @@ public function normalize($object, $format = null, array $context = []) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - AppInterface::class => TRUE, + AppInterface::class => true, ]; } } diff --git a/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php b/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php index 20b739b7..828e6d5a 100755 --- a/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php +++ b/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php @@ -57,9 +57,10 @@ public function supportsDenormalization($data, $type, $format = null) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - CompanyMembership::class => TRUE, + CompanyMembership::class => true, ]; } } diff --git a/src/Api/Management/Normalizer/AppCredentialNormalizer.php b/src/Api/Management/Normalizer/AppCredentialNormalizer.php index 2bdf1c42..0903c413 100644 --- a/src/Api/Management/Normalizer/AppCredentialNormalizer.php +++ b/src/Api/Management/Normalizer/AppCredentialNormalizer.php @@ -57,9 +57,10 @@ public function normalize($object, $format = null, array $context = []) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - AppCredentialInterface::class => TRUE, + AppCredentialInterface::class => true, ]; } } diff --git a/src/Api/Management/Normalizer/AppNormalizer.php b/src/Api/Management/Normalizer/AppNormalizer.php index bd5a48ae..5010f277 100644 --- a/src/Api/Management/Normalizer/AppNormalizer.php +++ b/src/Api/Management/Normalizer/AppNormalizer.php @@ -55,9 +55,10 @@ public function normalize($object, $format = null, array $context = []) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - AppInterface::class => TRUE, + AppInterface::class => true, ]; } } diff --git a/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php b/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php index 868477a8..b24eb998 100644 --- a/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php +++ b/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php @@ -39,8 +39,8 @@ public function normalize($object, $format = null, array $context = []) $normalized['developer'][] = (object) ['email' => $member, 'role' => $role]; } - //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. + // 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); } @@ -55,9 +55,10 @@ public function supportsNormalization($data, $format = null) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - CompanyMembership::class => TRUE, + CompanyMembership::class => true, ]; } } diff --git a/src/Denormalizer/AttributesPropertyDenormalizer.php b/src/Denormalizer/AttributesPropertyDenormalizer.php index 6b01b51c..72b204ed 100644 --- a/src/Denormalizer/AttributesPropertyDenormalizer.php +++ b/src/Denormalizer/AttributesPropertyDenormalizer.php @@ -67,9 +67,10 @@ public function denormalize($data, $type, $format = null, array $context = []) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - AttributesProperty::class => TRUE, + AttributesProperty::class => true, ]; } } diff --git a/src/Denormalizer/CredentialProductDenormalizer.php b/src/Denormalizer/CredentialProductDenormalizer.php index 819d1cfe..43cd89de 100644 --- a/src/Denormalizer/CredentialProductDenormalizer.php +++ b/src/Denormalizer/CredentialProductDenormalizer.php @@ -51,9 +51,10 @@ public function denormalize($data, $type, $format = null, array $context = []) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - CredentialProductInterface::class => TRUE, + CredentialProductInterface::class => true, ]; } } diff --git a/src/Denormalizer/EdgeDateDenormalizer.php b/src/Denormalizer/EdgeDateDenormalizer.php index c698d74c..66d3bd8e 100644 --- a/src/Denormalizer/EdgeDateDenormalizer.php +++ b/src/Denormalizer/EdgeDateDenormalizer.php @@ -60,7 +60,7 @@ public function denormalize($data, $type, $format = null, array $context = []) $context[$this->normalizer::FORMAT_KEY] = 'U'; $context[$this->normalizer::TIMEZONE_KEY] = new \DateTimeZone('UTC'); - //convert data in string format for denormalizer. + // convert data in string format for denormalizer. $data = (string) intval($data / 1000); return $this->normalizer->denormalize($data, $type, $format, $context); @@ -77,9 +77,10 @@ public function supportsDenormalization($data, $type, $format = null) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - '*' => FALSE, + '*' => false, ]; } } diff --git a/src/Denormalizer/KeyValueMapDenormalizer.php b/src/Denormalizer/KeyValueMapDenormalizer.php index 96b5b5bb..cdc0027f 100644 --- a/src/Denormalizer/KeyValueMapDenormalizer.php +++ b/src/Denormalizer/KeyValueMapDenormalizer.php @@ -50,9 +50,10 @@ public function supportsDenormalization($data, $type, $format = null) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - KeyValueMapInterface::class => TRUE, + KeyValueMapInterface::class => true, ]; } } diff --git a/src/Denormalizer/ObjectDenormalizer.php b/src/Denormalizer/ObjectDenormalizer.php index 31715c86..c0865d60 100644 --- a/src/Denormalizer/ObjectDenormalizer.php +++ b/src/Denormalizer/ObjectDenormalizer.php @@ -137,9 +137,10 @@ public function setSerializer(SerializerInterface $serializer): void /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - '*' => FALSE, + '*' => false, ]; } } diff --git a/src/Denormalizer/PropertiesPropertyDenormalizer.php b/src/Denormalizer/PropertiesPropertyDenormalizer.php index 2f51dd52..32d02590 100644 --- a/src/Denormalizer/PropertiesPropertyDenormalizer.php +++ b/src/Denormalizer/PropertiesPropertyDenormalizer.php @@ -57,9 +57,10 @@ public function denormalize($data, $type, $format = null, array $context = []) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - PropertiesProperty::class => TRUE, + PropertiesProperty::class => true, ]; } } diff --git a/src/Normalizer/CredentialProductNormalizer.php b/src/Normalizer/CredentialProductNormalizer.php index 02e7c934..3826a211 100644 --- a/src/Normalizer/CredentialProductNormalizer.php +++ b/src/Normalizer/CredentialProductNormalizer.php @@ -40,8 +40,8 @@ public function normalize($object, $format = null, array $context = []) 'status' => $object->getStatus(), ]; - //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. + // 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); } @@ -56,9 +56,10 @@ public function supportsNormalization($data, $format = null) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - CredentialProductInterface::class => TRUE, + CredentialProductInterface::class => true, ]; } } diff --git a/src/Normalizer/EdgeDateNormalizer.php b/src/Normalizer/EdgeDateNormalizer.php index 9ebca1f9..6c4af772 100644 --- a/src/Normalizer/EdgeDateNormalizer.php +++ b/src/Normalizer/EdgeDateNormalizer.php @@ -42,9 +42,10 @@ public function normalize($object, $format = null, array $context = []) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - \DateTimeInterface::class => TRUE, + \DateTimeInterface::class => true, ]; } } diff --git a/src/Normalizer/KeyValueMapNormalizer.php b/src/Normalizer/KeyValueMapNormalizer.php index 93b8e4f1..998c0427 100644 --- a/src/Normalizer/KeyValueMapNormalizer.php +++ b/src/Normalizer/KeyValueMapNormalizer.php @@ -50,9 +50,10 @@ public function supportsNormalization($data, $format = null) /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - KeyValueMapInterface::class => TRUE, + KeyValueMapInterface::class => true, ]; } } diff --git a/src/Normalizer/ObjectNormalizer.php b/src/Normalizer/ObjectNormalizer.php index 0c0ea608..9dae0cfe 100644 --- a/src/Normalizer/ObjectNormalizer.php +++ b/src/Normalizer/ObjectNormalizer.php @@ -131,16 +131,17 @@ public function setSerializer(SerializerInterface $serializer): void */ 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. + // default set ARRAY_AS_PROPS flag as we need entries to be accessed as properties. return new \ArrayObject($normalized, $array_as_props); } /** * {@inheritdoc} */ - public function getSupportedTypes(?string $format): array { + public function getSupportedTypes(?string $format): array + { return [ - '*' => FALSE, + '*' => false, ]; } } From b0747822fb78ca29a14d559b9195aa32ba41e9fd Mon Sep 17 00:00:00 2001 From: divyajose Date: Wed, 4 Oct 2023 14:00:02 +0530 Subject: [PATCH 3/4] additional files --- .../Denormalizer/RatePlanDenormalizerFactory.php | 10 ++++++++++ .../Normalizer/RatePlanNormalizerFactory.php | 10 ++++++++++ .../Denormalizer/DateTimeZoneDenormalizer.php | 13 ++++++++++++- .../Denormalizer/RatePlanDenormalizerFactory.php | 10 ++++++++++ .../Normalizer/DateTimeZoneNormalizer.php | 10 ++++++++++ .../Normalizer/RatePlanNormalizerFactory.php | 10 ++++++++++ 6 files changed, 62 insertions(+), 1 deletion(-) diff --git a/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php b/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php index 066f3a8d..c64cca65 100755 --- a/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php +++ b/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php @@ -93,4 +93,14 @@ public function setSerializer(SerializerInterface $serializer): void } } } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + '*' => false, + ]; + } } diff --git a/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php b/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php index 7307b0cb..3debb38a 100755 --- a/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php +++ b/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php @@ -93,4 +93,14 @@ public function setSerializer(SerializerInterface $serializer): void } } } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + '*' => false, + ]; + } } diff --git a/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php b/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php index 3f91ed78..049c807a 100644 --- a/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php +++ b/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php @@ -19,6 +19,7 @@ namespace Apigee\Edge\Api\Monetization\Denormalizer; use DateTimeZone; +use Exception; use Symfony\Component\Serializer\Exception\UnexpectedValueException; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -31,7 +32,7 @@ public function denormalize($data, $type, $format = null, array $context = []) { try { return new DateTimeZone($data); - } catch (\Exception $e) { + } catch (Exception $e) { throw new UnexpectedValueException(sprintf('"%s" is not a valid timezone.', $data), (int) $e->getCode(), $e); } } @@ -48,4 +49,14 @@ public function supportsDenormalization($data, $type, $format = null) return DateTimeZone::class === $type || $type instanceof DateTimeZone; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + DateTimeZone::class => true, + ]; + } } diff --git a/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php b/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php index 035e97c8..b425f999 100644 --- a/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php +++ b/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php @@ -90,4 +90,14 @@ public function setSerializer(SerializerInterface $serializer): void } } } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + '*' => false, + ]; + } } diff --git a/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php b/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php index bbd72c38..8eba9f35 100644 --- a/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php +++ b/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php @@ -38,4 +38,14 @@ public function supportsNormalization($data, $format = null) { return $data instanceof DateTimeZone; } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + DateTimeZone::class => true, + ]; + } } diff --git a/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php b/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php index ff21c8bf..0af7aff6 100644 --- a/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php +++ b/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php @@ -90,4 +90,14 @@ public function setSerializer(SerializerInterface $serializer): void } } } + + /** + * {@inheritdoc} + */ + public function getSupportedTypes(?string $format): array + { + return [ + '*' => false, + ]; + } } From 35144fa739097cf446e48241e2b5b21b76d937d0 Mon Sep 17 00:00:00 2001 From: divyajose Date: Thu, 5 Oct 2023 14:44:29 +0530 Subject: [PATCH 4/4] phpcs fix --- .../Normalizer/CompanyMembershipNormalizer.php | 3 ++- src/Denormalizer/EdgeDateDenormalizer.php | 12 ++++++++---- src/Normalizer/CredentialProductNormalizer.php | 3 ++- src/Normalizer/EdgeDateNormalizer.php | 5 +++-- src/Normalizer/ObjectNormalizer.php | 5 +++-- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php b/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php index b24eb998..02377355 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 @@ -41,7 +42,7 @@ public function normalize($object, $format = null, array $context = []) // 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/Denormalizer/EdgeDateDenormalizer.php b/src/Denormalizer/EdgeDateDenormalizer.php index 66d3bd8e..02ff769d 100644 --- a/src/Denormalizer/EdgeDateDenormalizer.php +++ b/src/Denormalizer/EdgeDateDenormalizer.php @@ -18,6 +18,10 @@ namespace Apigee\Edge\Denormalizer; +use DateTime; +use DateTimeImmutable; +use DateTimeInterface; +use DateTimeZone; use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -27,9 +31,9 @@ class EdgeDateDenormalizer implements DenormalizerInterface { private static $supportedTypes = [ - \DateTimeInterface::class => true, - \DateTimeImmutable::class => true, - \DateTime::class => true, + DateTimeInterface::class => true, + DateTimeImmutable::class => true, + DateTime::class => true, ]; /** @var \Symfony\Component\Serializer\Normalizer\DateTimeNormalizer */ @@ -58,7 +62,7 @@ public function denormalize($data, $type, $format = null, array $context = []) return null; } $context[$this->normalizer::FORMAT_KEY] = 'U'; - $context[$this->normalizer::TIMEZONE_KEY] = new \DateTimeZone('UTC'); + $context[$this->normalizer::TIMEZONE_KEY] = new DateTimeZone('UTC'); // convert data in string format for denormalizer. $data = (string) intval($data / 1000); diff --git a/src/Normalizer/CredentialProductNormalizer.php b/src/Normalizer/CredentialProductNormalizer.php index 3826a211..7a1b1adb 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; /** @@ -42,7 +43,7 @@ public function normalize($object, $format = null, array $context = []) // 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 6c4af772..77025207 100644 --- a/src/Normalizer/EdgeDateNormalizer.php +++ b/src/Normalizer/EdgeDateNormalizer.php @@ -18,6 +18,7 @@ namespace Apigee\Edge\Normalizer; +use DateTimeInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class EdgeDateNormalizer implements NormalizerInterface @@ -27,7 +28,7 @@ class EdgeDateNormalizer implements NormalizerInterface */ public function supportsNormalization($data, $format = null) { - return $data instanceof \DateTimeInterface; + return $data instanceof DateTimeInterface; } /** @@ -45,7 +46,7 @@ public function normalize($object, $format = null, array $context = []) public function getSupportedTypes(?string $format): array { return [ - \DateTimeInterface::class => true, + DateTimeInterface::class => true, ]; } } diff --git a/src/Normalizer/ObjectNormalizer.php b/src/Normalizer/ObjectNormalizer.php index 9dae0cfe..f04f2d99 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; @@ -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); } /**