Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue of Method normalize with return type '' is different to return type 'ArrayObject|array<array-key, mixed>|null|scalar' of inherited method NormalizerInterface::normalize #390

Merged
merged 3 commits into from
Oct 22, 2024
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
4 changes: 2 additions & 2 deletions src/Api/ApigeeX/Normalizer/AcceptedRatePlanNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,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($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
/** @var AcceptedRatePlanInterface $object */
/** @var object $normalized */
Expand All @@ -44,7 +44,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof AcceptedRatePlanInterface;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/ApigeeX/Normalizer/ApiProductNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,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($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
$normalized = parent::normalize($object, $format, $context);

Expand All @@ -58,7 +58,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof ApiProductInterface;
}
Expand Down
14 changes: 12 additions & 2 deletions src/Api/ApigeeX/Normalizer/AppGroupMembershipNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AppGroupMembershipNormalizer implements NormalizerInterface
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
$normalized = [];

Expand All @@ -44,8 +44,18 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof AppGroupMembership;
}

/**
* {@inheritdoc}
*/
public function getSupportedTypes(?string $format): array
{
return [
AppGroupMembership::class => true,
];
}
}
4 changes: 2 additions & 2 deletions src/Api/ApigeeX/Normalizer/AppNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AppNormalizer extends ObjectNormalizer implements NormalizerInterface
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof AppInterface;
}
Expand All @@ -41,7 +41,7 @@ public function supportsNormalization($data, $format = null)
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($object, $format, $context);
Expand Down
4 changes: 2 additions & 2 deletions src/Api/ApigeeX/Normalizer/BillingTypeNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BillingTypeNormalizer extends EntityNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
/** @var BillingTypeInterface $object */
/** @var object $normalized */
Expand All @@ -41,7 +41,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof BillingTypeInterface;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Api/ApigeeX/Normalizer/PrepaidBalanceNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
/**
* {@inheritDoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof PrepaidBalanceInterface;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/ApigeeX/Normalizer/RatePlanNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,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($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($object, $format, $context);
Expand All @@ -70,7 +70,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof RatePlanInterface;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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($object, $format = null, array $context = [])
public function normalize($object, $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 All @@ -70,7 +70,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
foreach ($this->normalizers as $denormalizer) {
if ($denormalizer->supportsNormalization($data, $format)) {
Expand Down
4 changes: 2 additions & 2 deletions src/Api/ApigeeX/Normalizer/RatePlanRateNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class RatePlanRateNormalizer extends ObjectNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($object, $format, $context);
Expand All @@ -46,7 +46,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof RatePlanRate;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/ApigeeX/Normalizer/StandardRatePlanNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class StandardRatePlanNormalizer extends RatePlanNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($object, $format, $context);
Expand All @@ -41,7 +41,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof StandardRatePlanInterface;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Management/Normalizer/AppCredentialNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AppCredentialNormalizer extends ObjectNormalizer implements NormalizerInte
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof AppCredentialInterface;
}
Expand All @@ -41,7 +41,7 @@ public function supportsNormalization($data, $format = null)
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($object, $format, $context);
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Management/Normalizer/AppNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AppNormalizer extends ObjectNormalizer implements NormalizerInterface
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof AppInterface;
}
Expand All @@ -41,7 +41,7 @@ public function supportsNormalization($data, $format = null)
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($object, $format, $context);
Expand Down
7 changes: 3 additions & 4 deletions src/Api/Management/Normalizer/CompanyMembershipNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
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
Expand All @@ -30,7 +29,7 @@ class CompanyMembershipNormalizer implements NormalizerInterface
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
$normalized = [
'developer' => [],
Expand All @@ -42,13 +41,13 @@ 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);
}

/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof CompanyMembership;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Management/Query/StatsQueryNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
/** @var StatsQueryInterface $object */
// Transform the object to JSON and back to an array to keep boolean values as boolean.
Expand Down Expand Up @@ -92,7 +92,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof StatsQuery;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AcceptedRatePlanNormalizer extends EntityNormalizer
* @psalm-suppress InvalidReturnType Returning an object here is required
* for creating a valid Apigee Edge request.
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
/** @var AcceptedRatePlanInterface $object */
/** @var object $normalized */
Expand All @@ -44,7 +44,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof AcceptedRatePlanInterface;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Monetization/Normalizer/AddressNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof Address;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Monetization/Normalizer/ApiPackageNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,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($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
$normalized = (array) parent::normalize($object, $format, $context);

Expand All @@ -63,7 +63,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof ApiPackageInterface;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Monetization/Normalizer/BalanceNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof BalanceInterface;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof CompanyAcceptedRatePlanInterface;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,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($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
/** @var object $normalized */
$normalized = parent::normalize($object, $format, $context);
Expand All @@ -59,7 +59,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof CompanyPaymentTransaction;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof CompanyRatePlanInterface;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof CompanyReportDefinitionInterface;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class DateTimeZoneNormalizer implements NormalizerInterface
/**
* {@inheritdoc}
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
return $object->getName();
}

/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
public function supportsNormalization($data, $format = null): bool
{
return $data instanceof DateTimeZone;
}
Expand Down
Loading
Loading