diff --git a/src/Symfony/Component/Serializer/Encoder/CsvEncoder.php b/src/Symfony/Component/Serializer/Encoder/CsvEncoder.php index fb0db43d5ecb..4ea3deb7834a 100644 --- a/src/Symfony/Component/Serializer/Encoder/CsvEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/CsvEncoder.php @@ -102,7 +102,7 @@ public function encode($data, string $format, array $context = []) /** * {@inheritdoc} */ - public function supportsEncoding($format) + public function supportsEncoding(string $format) { return self::FORMAT === $format; } @@ -184,7 +184,7 @@ public function decode(string $data, string $format, array $context = []) /** * {@inheritdoc} */ - public function supportsDecoding($format) + public function supportsDecoding(string $format) { return self::FORMAT === $format; } diff --git a/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractor.php b/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractor.php index 64d2ec29fde0..1f9fc6f7c15b 100644 --- a/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractor.php +++ b/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractor.php @@ -30,7 +30,7 @@ public function __construct(PropertyListExtractorInterface $propertyListExtracto /** * {@inheritdoc} */ - public function getProperties($object, array $context = []): ?array + public function getProperties(object $object, array $context = []): ?array { $class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object); diff --git a/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractorInterface.php b/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractorInterface.php index 1dd9b8b99a7d..5b2ae5837453 100644 --- a/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractorInterface.php +++ b/src/Symfony/Component/Serializer/Extractor/ObjectPropertyListExtractorInterface.php @@ -19,9 +19,7 @@ interface ObjectPropertyListExtractorInterface /** * Gets the list of properties available for the given object. * - * @param object $object - * * @return string[]|null */ - public function getProperties($object, array $context = []): ?array; + public function getProperties(object $object, array $context = []): ?array; } diff --git a/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php b/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php index a49051113dc1..61ddeffd8669 100644 --- a/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php +++ b/src/Symfony/Component/Serializer/Mapping/AttributeMetadata.php @@ -66,7 +66,7 @@ public function getName() /** * {@inheritdoc} */ - public function addGroup($group) + public function addGroup(string $group) { if (!\in_array($group, $this->groups)) { $this->groups[] = $group; @@ -84,7 +84,7 @@ public function getGroups() /** * {@inheritdoc} */ - public function setMaxDepth($maxDepth) + public function setMaxDepth(?int $maxDepth) { $this->maxDepth = $maxDepth; } diff --git a/src/Symfony/Component/Serializer/NameConverter/AdvancedNameConverterInterface.php b/src/Symfony/Component/Serializer/NameConverter/AdvancedNameConverterInterface.php index 03abdf18baf1..0b277d40ea51 100644 --- a/src/Symfony/Component/Serializer/NameConverter/AdvancedNameConverterInterface.php +++ b/src/Symfony/Component/Serializer/NameConverter/AdvancedNameConverterInterface.php @@ -21,10 +21,10 @@ interface AdvancedNameConverterInterface extends NameConverterInterface /** * {@inheritdoc} */ - public function normalize($propertyName, string $class = null, string $format = null, array $context = []); + public function normalize(string $propertyName, string $class = null, string $format = null, array $context = []); /** * {@inheritdoc} */ - public function denormalize($propertyName, string $class = null, string $format = null, array $context = []); + public function denormalize(string $propertyName, string $class = null, string $format = null, array $context = []); } diff --git a/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php b/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php index 970395efe14f..965409f91211 100644 --- a/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php +++ b/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php @@ -40,7 +40,7 @@ public function __construct(ClassMetadataFactoryInterface $metadataFactory, Name /** * {@inheritdoc} */ - public function normalize($propertyName, string $class = null, string $format = null, array $context = []): string + public function normalize(string $propertyName, string $class = null, string $format = null, array $context = []): string { if (null === $class) { return $this->normalizeFallback($propertyName, $class, $format, $context); @@ -56,7 +56,7 @@ public function normalize($propertyName, string $class = null, string $format = /** * {@inheritdoc} */ - public function denormalize($propertyName, string $class = null, string $format = null, array $context = []): string + public function denormalize(string $propertyName, string $class = null, string $format = null, array $context = []): string { if (null === $class) { return $this->denormalizeFallback($propertyName, $class, $format, $context); diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index 45e7c7abdb6e..13387e2bc818 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -170,14 +170,11 @@ public function hasCacheableSupportsMethod(): bool /** * Detects if the configured circular reference limit is reached. * - * @param object $object - * @param array $context - * * @return bool * * @throws CircularReferenceException */ - protected function isCircularReference($object, &$context) + protected function isCircularReference(object $object, array &$context) { $objectHash = spl_object_hash($object); @@ -229,7 +226,7 @@ protected function handleCircularReference(object $object, string $format = null * * @return string[]|AttributeMetadataInterface[]|bool */ - protected function getAllowedAttributes($classOrObject, array $context, $attributesAsString = false) + protected function getAllowedAttributes($classOrObject, array $context, bool $attributesAsString = false) { $allowExtraAttributes = $context[self::ALLOW_EXTRA_ATTRIBUTES] ?? $this->defaultContext[self::ALLOW_EXTRA_ATTRIBUTES]; if (!$this->classMetadataFactory) { @@ -265,12 +262,10 @@ protected function getAllowedAttributes($classOrObject, array $context, $attribu * Is this attribute allowed? * * @param object|string $classOrObject - * @param string $attribute - * @param string|null $format * * @return bool */ - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) + protected function isAllowedAttribute($classOrObject, string $attribute, string $format = null, array $context = []) { $ignoredAttributes = $context[self::IGNORED_ATTRIBUTES] ?? $this->defaultContext[self::IGNORED_ATTRIBUTES]; if (\in_array($attribute, $ignoredAttributes)) { @@ -307,12 +302,11 @@ protected function prepareForDenormalization($data) * Returns the method to use to construct an object. This method must be either * the object constructor or static. * - * @param string $class * @param array|bool $allowedAttributes * * @return \ReflectionMethod|null */ - protected function getConstructor(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes) + protected function getConstructor(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes) { return $reflectionClass->getConstructor(); } @@ -325,7 +319,6 @@ protected function getConstructor(array &$data, $class, array &$context, \Reflec * is removed from the context before being returned to avoid side effects * when recursively normalizing an object graph. * - * @param string $class * @param array|bool $allowedAttributes * * @return object @@ -333,7 +326,7 @@ protected function getConstructor(array &$data, $class, array &$context, \Reflec * @throws RuntimeException * @throws MissingConstructorArgumentsException */ - protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) + protected function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) { if (null !== $object = $this->extractObjectToPopulate($class, $context, self::OBJECT_TO_POPULATE)) { unset($context[self::OBJECT_TO_POPULATE]); @@ -408,7 +401,7 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref /** * @internal */ - protected function denormalizeParameter(\ReflectionClass $class, \ReflectionParameter $parameter, $parameterName, $parameterData, array $context, $format = null) + protected function denormalizeParameter(\ReflectionClass $class, \ReflectionParameter $parameter, string $parameterName, $parameterData, array $context, string $format = null) { try { if (null !== $parameter->getClass()) { diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index 58f737f1357e..1c0f0449ce6b 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -211,7 +211,7 @@ public function normalize($object, string $format = null, array $context = []) /** * {@inheritdoc} */ - protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) + protected function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) { if ($this->classDiscriminatorResolver && $mapping = $this->classDiscriminatorResolver->getMappingForClass($class)) { if (!isset($data[$mapping->getTypeProperty()])) { @@ -272,25 +272,21 @@ protected function getAttributes($object, string $format = null, array $context) /** * Extracts attributes to normalize from the class of the given object, format and context. * - * @param object $object - * * @return string[] */ - abstract protected function extractAttributes($object, string $format = null, array $context = []); + abstract protected function extractAttributes(object $object, string $format = null, array $context = []); /** * Gets the attribute value. * - * @param object $object - * * @return mixed */ - abstract protected function getAttributeValue($object, string $attribute, string $format = null, array $context = []); + abstract protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []); /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, string $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return class_exists($type) || (interface_exists($type, false) && $this->classDiscriminatorResolver && null !== $this->classDiscriminatorResolver->getMappingForClass($type)); } @@ -298,7 +294,7 @@ public function supportsDenormalization($data, $type, string $format = null) /** * {@inheritdoc} */ - public function denormalize($data, $type, string $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { if (!isset($context['cache_key'])) { $context['cache_key'] = $this->getCacheKey($format, $context); @@ -349,13 +345,8 @@ public function denormalize($data, $type, string $format = null, array $context /** * Sets attribute value. - * - * @param object $object - * @param string $attribute - * @param mixed $value - * @param string|null $format */ - abstract protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []); + abstract protected function setAttributeValue(object $object, string $attribute, $value, string $format = null, array $context = []); /** * Validates the submitted data and denormalizes it. @@ -435,7 +426,7 @@ private function validateAndDenormalize(string $currentClass, string $attribute, /** * @internal */ - protected function denormalizeParameter(\ReflectionClass $class, \ReflectionParameter $parameter, $parameterName, $parameterData, array $context, $format = null) + protected function denormalizeParameter(\ReflectionClass $class, \ReflectionParameter $parameter, string $parameterName, $parameterData, array $context, string $format = null) { if (null === $this->propertyTypeExtractor || null === $types = $this->propertyTypeExtractor->getTypes($class->getName(), $parameterName)) { return parent::denormalizeParameter($class, $parameter, $parameterName, $parameterData, $context, $format); diff --git a/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php index 01f15ab10055..b0f0ab1c0f30 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php @@ -36,7 +36,7 @@ class ArrayDenormalizer implements ContextAwareDenormalizerInterface, Serializer * * @throws NotNormalizableValueException */ - public function denormalize($data, $type, $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { if (null === $this->serializer) { throw new BadMethodCallException('Please set a serializer before calling denormalize()!'); @@ -66,7 +66,7 @@ public function denormalize($data, $type, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null, array $context = []) + public function supportsDenormalization($data, string $type, string $format = null, array $context = []) { return '[]' === substr($type, -2) && $this->serializer->supportsDenormalization($data, substr($type, 0, -2), $format, $context); diff --git a/src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php index 9437375f20db..c63aa00eb745 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php @@ -41,7 +41,7 @@ public function __construct($defaultContext = [], NameConverterInterface $nameCo /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, string $format = null, array $context = []) { $violations = []; $messages = []; @@ -83,7 +83,7 @@ public function normalize($object, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null) + public function supportsNormalization($data, string $format = null) { return $data instanceof ConstraintViolationListInterface; } diff --git a/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php index fbe74c1db3eb..9f72e896251c 100644 --- a/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php @@ -33,7 +33,7 @@ public function normalize($object, string $format = null, array $context = []) /** * {@inheritdoc} */ - public function denormalize($data, $type, string $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { $object = $this->extractObjectToPopulate($type, $context) ?: new $type(); $object->denormalize($this->serializer, $data, $format, $context); @@ -63,7 +63,7 @@ public function supportsNormalization($data, string $format = null) * * @return bool */ - public function supportsDenormalization($data, $type, string $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return is_subclass_of($type, DenormalizableInterface::class); } diff --git a/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php index 71b6ab4c96fe..657b5b62e89e 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php @@ -89,7 +89,7 @@ public function supportsNormalization($data, string $format = null) * @throws InvalidArgumentException * @throws NotNormalizableValueException */ - public function denormalize($data, $type, string $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { if (!preg_match('/^data:([a-z0-9][a-z0-9\!\#\$\&\-\^\_\+\.]{0,126}\/[a-z0-9][a-z0-9\!\#\$\&\-\^\_\+\.]{0,126}(;[a-z0-9\-]+\=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9\!\$\&\\\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i', $data)) { throw new NotNormalizableValueException('The provided "data:" URI is not valid.'); @@ -118,7 +118,7 @@ public function denormalize($data, $type, string $format = null, array $context /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, string $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return isset(self::$supportedTypes[$type]); } diff --git a/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php index 03e1d7945a78..54bf4b47f396 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php @@ -69,7 +69,7 @@ public function hasCacheableSupportsMethod(): bool * @throws InvalidArgumentException * @throws UnexpectedValueException */ - public function denormalize($data, $type, string $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { if (!\is_string($data)) { throw new InvalidArgumentException(sprintf('Data expected to be a string, %s given.', \gettype($data))); @@ -118,7 +118,7 @@ public function denormalize($data, $type, string $format = null, array $context /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, string $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return \DateInterval::class === $type; } diff --git a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php index 8588f4da6266..db191c26414b 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DateTimeNormalizer.php @@ -76,7 +76,7 @@ public function supportsNormalization($data, string $format = null) * * @throws NotNormalizableValueException */ - public function denormalize($data, $type, string $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { $dateTimeFormat = $context[self::FORMAT_KEY] ?? null; $timezone = $this->getTimezone($context); @@ -113,7 +113,7 @@ public function denormalize($data, $type, string $format = null, array $context /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, string $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return isset(self::$supportedTypes[$type]); } diff --git a/src/Symfony/Component/Serializer/Normalizer/DateTimeZoneNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/DateTimeZoneNormalizer.php index 8eaa3368f9f9..993f22fdffda 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DateTimeZoneNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/DateTimeZoneNormalizer.php @@ -48,7 +48,7 @@ public function supportsNormalization($data, string $format = null) * * @throws NotNormalizableValueException */ - public function denormalize($data, $type, string $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { if ('' === $data || null === $data) { throw new NotNormalizableValueException('The data is either an empty string or null, you should pass a string that can be parsed as a DateTimeZone.'); @@ -64,7 +64,7 @@ public function denormalize($data, $type, string $format = null, array $context /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, string $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return \DateTimeZone::class === $type; } diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php index 3e7021b13087..912d25b0d4c1 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php @@ -36,5 +36,5 @@ interface DenormalizableInterface * * @return object|object[] */ - public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []); + public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []); } diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php index 033acadc72eb..b9db497e4c25 100644 --- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php @@ -47,7 +47,7 @@ public function supportsNormalization($data, string $format = null) /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, string $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return parent::supportsDenormalization($data, $type, $format) && $this->supports($type); } @@ -97,7 +97,7 @@ private function isGetMethod(\ReflectionMethod $method): bool /** * {@inheritdoc} */ - protected function extractAttributes($object, $format = null, array $context = []) + protected function extractAttributes(object $object, string $format = null, array $context = []) { $reflectionObject = new \ReflectionObject($object); $reflectionMethods = $reflectionObject->getMethods(\ReflectionMethod::IS_PUBLIC); @@ -121,7 +121,7 @@ protected function extractAttributes($object, $format = null, array $context = [ /** * {@inheritdoc} */ - protected function getAttributeValue($object, $attribute, $format = null, array $context = []) + protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []) { $ucfirsted = ucfirst($attribute); @@ -144,7 +144,7 @@ protected function getAttributeValue($object, $attribute, $format = null, array /** * {@inheritdoc} */ - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) + protected function setAttributeValue(object $object, string $attribute, $value, string $format = null, array $context = []) { $setter = 'set'.ucfirst($attribute); $key = \get_class($object).':'.$setter; diff --git a/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php index e1ac2870071c..0b3167f9d224 100644 --- a/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/JsonSerializableNormalizer.php @@ -52,7 +52,7 @@ public function supportsNormalization($data, string $format = null) /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, string $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return false; } @@ -60,7 +60,7 @@ public function supportsDenormalization($data, $type, string $format = null) /** * {@inheritdoc} */ - public function denormalize($data, $type, string $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { throw new LogicException(sprintf('Cannot denormalize with "%s".', \JsonSerializable::class)); } diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index da1be0c30792..c2fa6557fe86 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -60,7 +60,7 @@ public function hasCacheableSupportsMethod(): bool /** * {@inheritdoc} */ - protected function extractAttributes($object, string $format = null, array $context = []) + protected function extractAttributes(object $object, string $format = null, array $context = []) { // If not using groups, detect manually $attributes = []; @@ -118,7 +118,7 @@ protected function extractAttributes($object, string $format = null, array $cont /** * {@inheritdoc} */ - protected function getAttributeValue($object, $attribute, string $format = null, array $context = []) + protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []) { $cacheKey = \get_class($object); if (!\array_key_exists($cacheKey, $this->discriminatorCache)) { @@ -135,7 +135,7 @@ protected function getAttributeValue($object, $attribute, string $format = null, /** * {@inheritdoc} */ - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) + protected function setAttributeValue(object $object, string $attribute, $value, string $format = null, array $context = []) { try { $this->propertyAccessor->setValue($object, $attribute, $value); @@ -147,7 +147,7 @@ protected function setAttributeValue($object, $attribute, $value, $format = null /** * {@inheritdoc} */ - protected function getAllowedAttributes($classOrObject, array $context, $attributesAsString = false) + protected function getAllowedAttributes($classOrObject, array $context, bool $attributesAsString = false) { if (false === $allowedAttributes = parent::getAllowedAttributes($classOrObject, $context, $attributesAsString)) { return false; diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectToPopulateTrait.php b/src/Symfony/Component/Serializer/Normalizer/ObjectToPopulateTrait.php index 65363a671a3d..16cdff355129 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectToPopulateTrait.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectToPopulateTrait.php @@ -23,7 +23,7 @@ trait ObjectToPopulateTrait * * @return object|null an object if things check out, null otherwise */ - protected function extractObjectToPopulate($class, array $context, $key = null) + protected function extractObjectToPopulate(string $class, array $context, string $key = null) { $key = $key ?? AbstractNormalizer::OBJECT_TO_POPULATE; diff --git a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php index 5991dd5b96a0..d73be893572e 100644 --- a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php @@ -41,7 +41,7 @@ public function supportsNormalization($data, string $format = null) /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, string $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return parent::supportsDenormalization($data, $type, $format) && $this->supports($type); } @@ -76,7 +76,7 @@ private function supports(string $class): bool /** * {@inheritdoc} */ - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) + protected function isAllowedAttribute($classOrObject, string $attribute, string $format = null, array $context = []) { if (!parent::isAllowedAttribute($classOrObject, $attribute, $format, $context)) { return false; @@ -97,7 +97,7 @@ protected function isAllowedAttribute($classOrObject, $attribute, $format = null /** * {@inheritdoc} */ - protected function extractAttributes($object, string $format = null, array $context = []) + protected function extractAttributes(object $object, string $format = null, array $context = []) { $reflectionObject = new \ReflectionObject($object); $attributes = []; @@ -118,7 +118,7 @@ protected function extractAttributes($object, string $format = null, array $cont /** * {@inheritdoc} */ - protected function getAttributeValue($object, $attribute, string $format = null, array $context = []) + protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []) { try { $reflectionProperty = $this->getReflectionProperty($object, $attribute); @@ -137,7 +137,7 @@ protected function getAttributeValue($object, $attribute, string $format = null, /** * {@inheritdoc} */ - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) + protected function setAttributeValue(object $object, string $attribute, $value, string $format = null, array $context = []) { try { $reflectionProperty = $this->getReflectionProperty($object, $attribute); diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index 74f8733b5b2d..407019bab7cf 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -109,7 +109,7 @@ public function __construct(array $normalizers = [], array $encoders = []) /** * {@inheritdoc} */ - final public function serialize($data, $format, array $context = []) + final public function serialize($data, string $format, array $context = []) { if (!$this->supportsEncoding($format, $context)) { throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported', $format)); @@ -125,7 +125,7 @@ final public function serialize($data, $format, array $context = []) /** * {@inheritdoc} */ - final public function deserialize($data, $type, $format, array $context = []) + final public function deserialize($data, string $type, string $format, array $context = []) { if (!$this->supportsDecoding($format, $context)) { throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported', $format)); @@ -139,7 +139,7 @@ final public function deserialize($data, $type, $format, array $context = []) /** * {@inheritdoc} */ - public function normalize($data, $format = null, array $context = []) + public function normalize($data, string $format = null, array $context = []) { // If a normalizer supports the given data, use it if ($normalizer = $this->getNormalizer($data, $format, $context)) { @@ -175,7 +175,7 @@ public function normalize($data, $format = null, array $context = []) * * @throws NotNormalizableValueException */ - public function denormalize($data, $type, $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { if (!$this->normalizers) { throw new LogicException('You must register at least one normalizer to be able to denormalize objects.'); @@ -191,7 +191,7 @@ public function denormalize($data, $type, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null, array $context = []) + public function supportsNormalization($data, string $format = null, array $context = []) { return null !== $this->getNormalizer($data, $format, $context); } @@ -199,7 +199,7 @@ public function supportsNormalization($data, $format = null, array $context = [] /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null, array $context = []) + public function supportsDenormalization($data, string $type, string $format = null, array $context = []) { return null !== $this->getDenormalizer($data, $type, $format, $context); } @@ -282,7 +282,7 @@ private function getDenormalizer($data, string $class, ?string $format, array $c /** * {@inheritdoc} */ - final public function encode($data, $format, array $context = []) + final public function encode($data, string $format, array $context = []) { return $this->encoder->encode($data, $format, $context); } @@ -290,7 +290,7 @@ final public function encode($data, $format, array $context = []) /** * {@inheritdoc} */ - final public function decode($data, $format, array $context = []) + final public function decode(string $data, string $format, array $context = []) { return $this->decoder->decode($data, $format, $context); } @@ -298,7 +298,7 @@ final public function decode($data, $format, array $context = []) /** * {@inheritdoc} */ - public function supportsEncoding($format, array $context = []) + public function supportsEncoding(string $format, array $context = []) { return $this->encoder->supportsEncoding($format, $context); } @@ -306,7 +306,7 @@ public function supportsEncoding($format, array $context = []) /** * {@inheritdoc} */ - public function supportsDecoding($format, array $context = []) + public function supportsDecoding(string $format, array $context = []) { return $this->decoder->supportsDecoding($format, $context); } diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php index 2294b2afec51..98ca99699bd9 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php @@ -124,12 +124,12 @@ class ChainNormalizationAwareEncoder extends ChainEncoder implements Normalizati class NormalizationAwareEncoder implements EncoderInterface, NormalizationAwareInterface { - public function supportsEncoding($format) + public function supportsEncoding(string $format) { return true; } - public function encode($data, $format, array $context = []) + public function encode($data, string $format, array $context = []) { } } diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php index 94a5e895c6c4..1dda913c5575 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php @@ -23,7 +23,7 @@ class AbstractNormalizerDummy extends AbstractNormalizer /** * {@inheritdoc} */ - public function getAllowedAttributes($classOrObject, array $context, $attributesAsString = false) + public function getAllowedAttributes($classOrObject, array $context, bool $attributesAsString = false) { return parent::getAllowedAttributes($classOrObject, $context, $attributesAsString); } @@ -31,14 +31,14 @@ public function getAllowedAttributes($classOrObject, array $context, $attributes /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, string $format = null, array $context = []) { } /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null) + public function supportsNormalization($data, string $format = null) { return true; } @@ -46,14 +46,14 @@ public function supportsNormalization($data, $format = null) /** * {@inheritdoc} */ - public function denormalize($data, $type, $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { } /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return true; } diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php b/src/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php index ded194ba80fc..e7c03e3d8ec0 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php @@ -16,7 +16,7 @@ class DenormalizableDummy implements DenormalizableInterface { - public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []) + public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []) { } } diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/Dummy.php b/src/Symfony/Component/Serializer/Tests/Fixtures/Dummy.php index bb734ddc7e09..da0400593d25 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/Dummy.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/Dummy.php @@ -23,7 +23,7 @@ class Dummy implements NormalizableInterface, DenormalizableInterface public $baz; public $qux; - public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) { return [ 'foo' => $this->foo, @@ -33,7 +33,7 @@ public function normalize(NormalizerInterface $normalizer, $format = null, array ]; } - public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []) + public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []) { $this->foo = $data['foo']; $this->bar = $data['bar']; diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/NormalizableTraversableDummy.php b/src/Symfony/Component/Serializer/Tests/Fixtures/NormalizableTraversableDummy.php index 2ce2adffd798..55b4402b076f 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/NormalizableTraversableDummy.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/NormalizableTraversableDummy.php @@ -18,7 +18,7 @@ class NormalizableTraversableDummy extends TraversableDummy implements NormalizableInterface, DenormalizableInterface { - public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) { return [ 'foo' => 'normalizedFoo', @@ -26,7 +26,7 @@ public function normalize(NormalizerInterface $normalizer, $format = null, array ]; } - public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []) + public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []) { return [ 'foo' => 'denormalizedFoo', diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/ScalarDummy.php b/src/Symfony/Component/Serializer/Tests/Fixtures/ScalarDummy.php index 438a902e23e3..ffe4ee65859a 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/ScalarDummy.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/ScalarDummy.php @@ -21,12 +21,12 @@ class ScalarDummy implements NormalizableInterface, DenormalizableInterface public $foo; public $xmlFoo; - public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) { return 'xml' === $format ? $this->xmlFoo : $this->foo; } - public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = []) + public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []) { if ('xml' === $format) { $this->xmlFoo = $data; diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/StaticConstructorNormalizer.php b/src/Symfony/Component/Serializer/Tests/Fixtures/StaticConstructorNormalizer.php index 67304831f892..3d2ac9d73c4b 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/StaticConstructorNormalizer.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/StaticConstructorNormalizer.php @@ -21,7 +21,7 @@ class StaticConstructorNormalizer extends ObjectNormalizer /** * {@inheritdoc} */ - protected function getConstructor(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes) + protected function getConstructor(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes) { if (is_a($class, StaticConstructorDummy::class, true)) { return new \ReflectionMethod($class, 'create'); diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/TestClassMetadataFactory.php b/src/Symfony/Component/Serializer/Tests/Mapping/TestClassMetadataFactory.php index f435d36f744d..71fa42be8a06 100644 --- a/src/Symfony/Component/Serializer/Tests/Mapping/TestClassMetadataFactory.php +++ b/src/Symfony/Component/Serializer/Tests/Mapping/TestClassMetadataFactory.php @@ -19,7 +19,7 @@ */ class TestClassMetadataFactory { - public static function createClassMetadata($withParent = false, $withInterface = false) + public static function createClassMetadata(bool $withParent = false, bool $withInterface = false) { $expected = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\GroupDummy'); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php index 0f7cd4412773..9bc20d8c0814 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -214,26 +214,26 @@ public function testNormalizeEmptyObject() class AbstractObjectNormalizerDummy extends AbstractObjectNormalizer { - protected function extractAttributes($object, $format = null, array $context = []) + protected function extractAttributes(object $object, string $format = null, array $context = []) { return []; } - protected function getAttributeValue($object, $attribute, $format = null, array $context = []) + protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []) { } - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) + protected function setAttributeValue(object $object, string $attribute, $value, string $format = null, array $context = []) { $object->$attribute = $value; } - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) + protected function isAllowedAttribute($classOrObject, string $attribute, string $format = null, array $context = []) { return \in_array($attribute, ['foo', 'baz', 'quux', 'value']); } - public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) + public function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) { return parent::instantiateObject($data, $class, $context, $reflectionClass, $allowedAttributes, $format); } @@ -257,15 +257,15 @@ public function __construct() parent::__construct(new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()))); } - protected function extractAttributes($object, $format = null, array $context = []) + protected function extractAttributes(object $object, string $format = null, array $context = []) { } - protected function getAttributeValue($object, $attribute, $format = null, array $context = []) + protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []) { } - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) + protected function setAttributeValue(object $object, string $attribute, $value, string $format = null, array $context = []) { $object->$attribute = $value; } @@ -289,20 +289,20 @@ class SerializerCollectionDummy implements SerializerInterface, DenormalizerInte /** * @param DenormalizerInterface[] $normalizers */ - public function __construct($normalizers) + public function __construct(array $normalizers) { $this->normalizers = $normalizers; } - public function serialize($data, $format, array $context = []) + public function serialize($data, string $format, array $context = []) { } - public function deserialize($data, $type, $format, array $context = []) + public function deserialize($data, string $type, string $format, array $context = []) { } - public function denormalize($data, $type, $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { foreach ($this->normalizers as $normalizer) { if ($normalizer instanceof DenormalizerInterface && $normalizer->supportsDenormalization($data, $type, $format, $context)) { @@ -311,7 +311,7 @@ public function denormalize($data, $type, $format = null, array $context = []) } } - public function supportsDenormalization($data, $type, $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return true; } @@ -319,34 +319,34 @@ public function supportsDenormalization($data, $type, $format = null) class AbstractObjectNormalizerCollectionDummy extends AbstractObjectNormalizer { - protected function extractAttributes($object, $format = null, array $context = []) + protected function extractAttributes(object $object, string $format = null, array $context = []) { } - protected function getAttributeValue($object, $attribute, $format = null, array $context = []) + protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []) { } - protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = []) + protected function setAttributeValue(object $object, string $attribute, $value, string $format = null, array $context = []) { $object->$attribute = $value; } - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) + protected function isAllowedAttribute($classOrObject, string $attribute, string $format = null, array $context = []) { return true; } - public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) + public function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) { return parent::instantiateObject($data, $class, $context, $reflectionClass, $allowedAttributes, $format); } - public function serialize($data, $format, array $context = []) + public function serialize($data, string $format, array $context = []) { } - public function deserialize($data, $type, $format, array $context = []) + public function deserialize($data, string $type, string $format, array $context = []) { } } @@ -363,7 +363,7 @@ class ArrayDenormalizerDummy implements DenormalizerInterface, SerializerAwareIn * * @throws NotNormalizableValueException */ - public function denormalize($data, $type, $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { $serializer = $this->serializer; $type = substr($type, 0, -2); @@ -378,7 +378,7 @@ public function denormalize($data, $type, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null, array $context = []) + public function supportsDenormalization($data, string $type, string $format = null, array $context = []) { return '[]' === substr($type, -2) && $this->serializer->supportsDenormalization($data, substr($type, 0, -2), $format, $context); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php index 3f8a559850d9..89542f7d657b 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php @@ -599,12 +599,12 @@ public function testExtractAttributesRespectsContext() public function testAdvancedNameConverter() { $nameConverter = new class() implements AdvancedNameConverterInterface { - public function normalize($propertyName, string $class = null, string $format = null, array $context = []) + public function normalize(string $propertyName, string $class = null, string $format = null, array $context = []): string { return sprintf('%s-%s-%s-%s', $propertyName, $class, $format, $context['foo']); } - public function denormalize($propertyName, string $class = null, string $format = null, array $context = []) + public function denormalize(string $propertyName, string $class = null, string $format = null, array $context = []): string { return sprintf('%s-%s-%s-%s', $propertyName, $class, $format, $context['foo']); } @@ -833,7 +833,7 @@ class ObjectInner class FormatAndContextAwareNormalizer extends ObjectNormalizer { - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) + protected function isAllowedAttribute($classOrObject, string $attribute, string $format = null, array $context = []) { if (\in_array($attribute, ['foo', 'bar']) && 'foo_and_bar_included' === $format) { return true; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php b/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php index eefef12d4518..2e909494ab1f 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php @@ -23,14 +23,14 @@ class TestDenormalizer implements DenormalizerInterface /** * {@inheritdoc} */ - public function denormalize($data, $type, $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { } /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null) + public function supportsDenormalization($data, string $type, string $format = null) { return true; } diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php b/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php index ea57d2dfff54..759fd83ade03 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php @@ -23,14 +23,14 @@ class TestNormalizer implements NormalizerInterface /** * {@inheritdoc} */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, string $format = null, array $context = []) { } /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null) + public function supportsNormalization($data, string $format = null) { return true; } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy