DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -40,19 +40,13 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte
{
use NormalizerAwareTrait;
private ClassMetadataFactoryInterface $classMetadataFactory;
private PropertyAccessor $propertyAccess;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
ClassMetadataFactoryInterface $classMetadataFactory,
TranslatableStringHelperInterface $translatableStringHelper
private ClassMetadataFactoryInterface $classMetadataFactory,
private TranslatableStringHelperInterface $translatableStringHelper
) {
$this->classMetadataFactory = $classMetadataFactory;
$this->propertyAccess = PropertyAccess::createPropertyAccessor();
$this->translatableStringHelper = $translatableStringHelper;
}
public function normalize($object, $format = null, array $context = [])
@@ -66,7 +60,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte
if (!$this->classMetadataFactory->hasMetadataFor($classMetadataKey)) {
throw new LogicException(sprintf(
'This object does not have metadata: %s. Add groups on this entity to allow to serialize with the format %s and groups %s',
is_object($object) ? get_class($object) : '(todo' /*$context['docgen:expects'],*/ ,
is_object($object) ? $object::class : '(todo' /*$context['docgen:expects'],*/ ,
$format,
implode(', ', ($context['groups'] ?? []))
));
@@ -199,10 +193,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte
return $normalizer->normalize($keys, $format, $context, $metadata);
}
/**
* @param mixed $format
*/
private function normalizeNullOutputValue($format, array $context, AttributeMetadata $attribute, ReflectionClass $reflection)
private function normalizeNullOutputValue(mixed $format, array $context, AttributeMetadata $attribute, ReflectionClass $reflection)
{
$type = $this->getExpectedType($attribute, $reflection);