mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -11,9 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Serializer\Model;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
class Counter implements JsonSerializable
|
||||
class Counter implements \JsonSerializable
|
||||
{
|
||||
public function __construct(private ?int $counter) {}
|
||||
|
||||
|
@@ -14,7 +14,6 @@ namespace Chill\MainBundle\Serializer\Normalizer;
|
||||
use Chill\DocGeneratorBundle\Serializer\Helper\NormalizeNullValueHelper;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Templating\Entity\AddressRender;
|
||||
use DateTimeInterface;
|
||||
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
|
||||
@@ -43,15 +42,15 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw
|
||||
'buildingName',
|
||||
'distribution',
|
||||
'extra',
|
||||
'validFrom' => DateTimeInterface::class,
|
||||
'validTo' => DateTimeInterface::class,
|
||||
'validFrom' => \DateTimeInterface::class,
|
||||
'validTo' => \DateTimeInterface::class,
|
||||
'confidential',
|
||||
];
|
||||
|
||||
public function __construct(private readonly AddressRender $addressRender) {}
|
||||
|
||||
/**
|
||||
* @param Address $address
|
||||
* @param Address $address
|
||||
* @param string|null $format
|
||||
*/
|
||||
public function normalize($address, $format = null, array $context = [])
|
||||
@@ -100,7 +99,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw
|
||||
);
|
||||
$data['isNoAddress'] = $address->isNoAddress();
|
||||
} elseif ('docgen' === $format) {
|
||||
$dateContext = array_merge($context, ['docgen:expects' => DateTimeInterface::class]);
|
||||
$dateContext = array_merge($context, ['docgen:expects' => \DateTimeInterface::class]);
|
||||
$data['validFrom'] = $this->normalizer->normalize($address->getValidFrom(), $format, $dateContext);
|
||||
$data['validTo'] = $this->normalizer->normalize($address->getValidTo(), $format, $dateContext);
|
||||
}
|
||||
|
@@ -18,8 +18,6 @@ use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
class CenterNormalizer implements DenormalizerInterface, NormalizerInterface
|
||||
{
|
||||
public function __construct(private readonly CenterRepository $repository) {}
|
||||
@@ -30,7 +28,7 @@ class CenterNormalizer implements DenormalizerInterface, NormalizerInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
if (false === array_key_exists('type', $data)) {
|
||||
if (false === \array_key_exists('type', $data)) {
|
||||
throw new InvalidArgumentException('missing "type" key in data');
|
||||
}
|
||||
|
||||
@@ -38,7 +36,7 @@ class CenterNormalizer implements DenormalizerInterface, NormalizerInterface
|
||||
throw new InvalidArgumentException('type should be equal to "center"');
|
||||
}
|
||||
|
||||
if (false === array_key_exists('id', $data)) {
|
||||
if (false === \array_key_exists('id', $data)) {
|
||||
throw new InvalidArgumentException('missing "id" key in data');
|
||||
}
|
||||
|
||||
@@ -53,12 +51,12 @@ class CenterNormalizer implements DenormalizerInterface, NormalizerInterface
|
||||
|
||||
public function normalize($center, $format = null, array $context = [])
|
||||
{
|
||||
/** @var Center $center */
|
||||
/* @var Center $center */
|
||||
return [
|
||||
'id' => $center->getId(),
|
||||
'type' => 'center',
|
||||
'name' => $center->getName(),
|
||||
'isActive' => $center->getIsActive()
|
||||
'isActive' => $center->getIsActive(),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,7 @@ class CollectionNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
||||
use NormalizerAwareTrait;
|
||||
|
||||
/**
|
||||
* @param Collection $collection
|
||||
* @param Collection $collection
|
||||
* @param string|null $format
|
||||
*/
|
||||
public function normalize($collection, $format = null, array $context = [])
|
||||
|
@@ -14,12 +14,10 @@ namespace Chill\MainBundle\Serializer\Normalizer;
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use DateTime;
|
||||
use Symfony\Component\Serializer\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||
use function array_key_exists;
|
||||
|
||||
class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
|
||||
{
|
||||
@@ -32,14 +30,14 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa
|
||||
*
|
||||
* @throws ExceptionInterface
|
||||
*/
|
||||
public function normalize($object, ?string $format = null, array $context = []): array
|
||||
public function normalize($object, string $format = null, array $context = []): array
|
||||
{
|
||||
if (null === $object || ($object->isEmpty())) {
|
||||
if (null === $object || $object->isEmpty()) {
|
||||
return [
|
||||
'comment' => '',
|
||||
'isNull' => true,
|
||||
'date' => $this->normalizer->normalize(null, $format, array_merge($context, [
|
||||
'docgen:expects' => DateTime::class,
|
||||
'docgen:expects' => \DateTime::class,
|
||||
])),
|
||||
'user' => $this->normalizer->normalize(null, $format, array_merge($context, [
|
||||
'docgen:expects' => User::class,
|
||||
@@ -57,7 +55,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa
|
||||
'comment' => $object->getComment(),
|
||||
'isNull' => false,
|
||||
'date' => $this->normalizer->normalize($object->getDate(), $format, array_merge($context, [
|
||||
'docgen:expects' => DateTime::class,
|
||||
'docgen:expects' => \DateTime::class,
|
||||
])),
|
||||
'user' => $this->normalizer->normalize($user, $format, array_merge($context, [
|
||||
'docgen:expects' => User::class,
|
||||
@@ -65,7 +63,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa
|
||||
];
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||
public function supportsNormalization($data, string $format = null, array $context = []): bool
|
||||
{
|
||||
if ('docgen' !== $format) {
|
||||
return false;
|
||||
@@ -77,7 +75,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa
|
||||
|
||||
if (
|
||||
null === $data
|
||||
&& array_key_exists('docgen:expects', $context)
|
||||
&& \array_key_exists('docgen:expects', $context)
|
||||
&& CommentEmbeddable::class === $context['docgen:expects']) {
|
||||
return true;
|
||||
}
|
||||
|
@@ -11,19 +11,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Serializer\Normalizer;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use IntlDateFormatter;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function is_array;
|
||||
|
||||
class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInterface
|
||||
{
|
||||
public function __construct(private readonly RequestStack $requestStack, private readonly ParameterBagInterface $parameterBag) {}
|
||||
@@ -35,14 +29,14 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case DateTime::class:
|
||||
$result = DateTime::createFromFormat(DateTimeInterface::ISO8601, $data['datetime']);
|
||||
case \DateTime::class:
|
||||
$result = \DateTime::createFromFormat(\DateTimeInterface::ISO8601, $data['datetime']);
|
||||
|
||||
break;
|
||||
|
||||
case DateTimeInterface::class:
|
||||
case DateTimeImmutable::class:
|
||||
$result = DateTimeImmutable::createFromFormat(DateTimeInterface::ISO8601, $data['datetime']);
|
||||
case \DateTimeInterface::class:
|
||||
case \DateTimeImmutable::class:
|
||||
$result = \DateTimeImmutable::createFromFormat(\DateTimeInterface::ISO8601, $data['datetime']);
|
||||
|
||||
break;
|
||||
|
||||
@@ -59,12 +53,12 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt
|
||||
|
||||
public function normalize($date, $format = null, array $context = [])
|
||||
{
|
||||
/** @var DateTimeInterface $date */
|
||||
/* @var DateTimeInterface $date */
|
||||
switch ($format) {
|
||||
case 'json':
|
||||
return [
|
||||
'datetime' => $date->format(DateTimeInterface::ISO8601),
|
||||
'datetime8601' => $date->format(DateTimeInterface::ATOM),
|
||||
'datetime' => $date->format(\DateTimeInterface::ISO8601),
|
||||
'datetime8601' => $date->format(\DateTimeInterface::ATOM),
|
||||
];
|
||||
|
||||
case 'docgen':
|
||||
@@ -74,18 +68,18 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt
|
||||
];
|
||||
}
|
||||
|
||||
$hasTime = $date->format('His') !== '000000';
|
||||
$hasTime = '000000' !== $date->format('His');
|
||||
$request = $this->requestStack->getCurrentRequest();
|
||||
$locale = null !== $request ? $request->getLocale() : $this->parameterBag->get('kernel.default_locale');
|
||||
$formatterLong = IntlDateFormatter::create(
|
||||
$formatterLong = \IntlDateFormatter::create(
|
||||
$locale,
|
||||
IntlDateFormatter::LONG,
|
||||
$hasTime ? IntlDateFormatter::SHORT : IntlDateFormatter::NONE
|
||||
\IntlDateFormatter::LONG,
|
||||
$hasTime ? \IntlDateFormatter::SHORT : \IntlDateFormatter::NONE
|
||||
);
|
||||
$formatterShort = IntlDateFormatter::create(
|
||||
$formatterShort = \IntlDateFormatter::create(
|
||||
$locale,
|
||||
IntlDateFormatter::SHORT,
|
||||
$hasTime ? IntlDateFormatter::SHORT : IntlDateFormatter::NONE
|
||||
\IntlDateFormatter::SHORT,
|
||||
$hasTime ? \IntlDateFormatter::SHORT : \IntlDateFormatter::NONE
|
||||
);
|
||||
|
||||
return [
|
||||
@@ -97,26 +91,26 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt
|
||||
|
||||
public function supportsDenormalization($data, $type, $format = null): bool
|
||||
{
|
||||
return DateTimeInterface::class === $type
|
||||
|| DateTime::class === $type
|
||||
|| DateTimeImmutable::class === $type
|
||||
|| (is_array($data) && array_key_exists('datetime', $data));
|
||||
return \DateTimeInterface::class === $type
|
||||
|| \DateTime::class === $type
|
||||
|| \DateTimeImmutable::class === $type
|
||||
|| (\is_array($data) && \array_key_exists('datetime', $data));
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, $format = null, array $context = []): bool
|
||||
{
|
||||
if ('json' === $format) {
|
||||
return $data instanceof DateTimeInterface;
|
||||
return $data instanceof \DateTimeInterface;
|
||||
}
|
||||
|
||||
if ('docgen' === $format) {
|
||||
return $data instanceof DateTimeInterface || (
|
||||
return $data instanceof \DateTimeInterface || (
|
||||
null === $data
|
||||
&& array_key_exists('docgen:expects', $context)
|
||||
&& \array_key_exists('docgen:expects', $context)
|
||||
&& (
|
||||
DateTimeInterface::class === $context['docgen:expects']
|
||||
|| DateTime::class === $context['docgen:expects']
|
||||
|| DateTimeImmutable::class === $context['docgen:expects']
|
||||
\DateTimeInterface::class === $context['docgen:expects']
|
||||
|| \DateTime::class === $context['docgen:expects']
|
||||
|| \DateTimeImmutable::class === $context['docgen:expects']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@@ -11,16 +11,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Serializer\Normalizer;
|
||||
|
||||
use LogicException;
|
||||
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
|
||||
use Symfony\Component\Serializer\Exception\RuntimeException;
|
||||
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
|
||||
|
||||
use function count;
|
||||
use function implode;
|
||||
|
||||
/**
|
||||
* Denormalize an object given a list of supported class.
|
||||
*/
|
||||
@@ -51,8 +47,7 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException(sprintf('Could not find any denormalizer for those ' .
|
||||
'ALLOWED_TYPES: %s', implode(', ', $context[self::ALLOWED_TYPES])));
|
||||
throw new RuntimeException(sprintf('Could not find any denormalizer for those ALLOWED_TYPES: %s', \implode(', ', $context[self::ALLOWED_TYPES])));
|
||||
}
|
||||
|
||||
public function supportsDenormalization($data, $type, $format = null, array $context = [])
|
||||
@@ -61,8 +56,8 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 === count($context[self::ALLOWED_TYPES] ?? [])) {
|
||||
throw new LogicException('The context should contains a list of
|
||||
if (0 === \count($context[self::ALLOWED_TYPES] ?? [])) {
|
||||
throw new \LogicException('The context should contains a list of
|
||||
allowed types');
|
||||
}
|
||||
|
||||
|
@@ -17,17 +17,13 @@ use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
use function is_array;
|
||||
|
||||
class DoctrineExistingEntityNormalizer implements DenormalizerInterface
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $em, private readonly ClassMetadataFactoryInterface $serializerMetadataFactory) {}
|
||||
|
||||
public function denormalize($data, $type, $format = null, array $context = [])
|
||||
{
|
||||
if (array_key_exists(AbstractNormalizer::OBJECT_TO_POPULATE, $context)) {
|
||||
if (\array_key_exists(AbstractNormalizer::OBJECT_TO_POPULATE, $context)) {
|
||||
return $context[AbstractNormalizer::OBJECT_TO_POPULATE];
|
||||
}
|
||||
|
||||
@@ -37,11 +33,11 @@ class DoctrineExistingEntityNormalizer implements DenormalizerInterface
|
||||
|
||||
public function supportsDenormalization($data, $type, $format = null)
|
||||
{
|
||||
if (false === is_array($data)) {
|
||||
if (false === \is_array($data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (false === array_key_exists('id', $data)) {
|
||||
if (false === \array_key_exists('id', $data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -60,13 +56,13 @@ class DoctrineExistingEntityNormalizer implements DenormalizerInterface
|
||||
// check that only 2 keys
|
||||
// that the second key is property
|
||||
// and that the type match the class for given type property
|
||||
return count($data) === 2
|
||||
&& array_key_exists($typeProperty, $data)
|
||||
return 2 === \count($data)
|
||||
&& \array_key_exists($typeProperty, $data)
|
||||
&& $classDiscriminator->getClassForType($data[$typeProperty]) === $type;
|
||||
}
|
||||
}
|
||||
|
||||
// we do not have any class discriminator. Check that the id is the only one key
|
||||
return count($data) === 1;
|
||||
return 1 === \count($data);
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ class EntityWorkflowNormalizer implements NormalizerInterface, NormalizerAwareIn
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function normalize($object, ?string $format = null, array $context = [])
|
||||
public function normalize($object, string $format = null, array $context = [])
|
||||
{
|
||||
$workflow = $this->registry->get($object, $object->getWorkflowName());
|
||||
$handler = $this->entityWorkflowManager->getHandler($object);
|
||||
@@ -48,7 +48,7 @@ class EntityWorkflowNormalizer implements NormalizerInterface, NormalizerAwareIn
|
||||
];
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null): bool
|
||||
public function supportsNormalization($data, string $format = null): bool
|
||||
{
|
||||
return $data instanceof EntityWorkflow && 'json' === $format;
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ class EntityWorkflowStepNormalizer implements NormalizerAwareInterface, Normaliz
|
||||
/**
|
||||
* @param EntityWorkflowStep $object
|
||||
*/
|
||||
public function normalize($object, ?string $format = null, array $context = []): array
|
||||
public function normalize($object, string $format = null, array $context = []): array
|
||||
{
|
||||
$data = [
|
||||
'type' => 'entity_workflow_step',
|
||||
@@ -75,7 +75,7 @@ class EntityWorkflowStepNormalizer implements NormalizerAwareInterface, Normaliz
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null): bool
|
||||
public function supportsNormalization($data, string $format = null): bool
|
||||
{
|
||||
return $data instanceof EntityWorkflowStep && 'json' === $format;
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Serializer\Normalizer;
|
||||
|
||||
use ArrayObject;
|
||||
use Chill\MainBundle\Entity\Notification;
|
||||
use Chill\MainBundle\Notification\NotificationHandlerManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -29,9 +28,9 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte
|
||||
/**
|
||||
* @param Notification $object
|
||||
*
|
||||
* @return array|ArrayObject|bool|float|int|string|void|null
|
||||
* @return array|\ArrayObject|bool|float|int|string|void|null
|
||||
*/
|
||||
public function normalize($object, ?string $format = null, array $context = [])
|
||||
public function normalize($object, string $format = null, array $context = [])
|
||||
{
|
||||
$entity = $this->entityManager
|
||||
->getRepository($object->getRelatedEntityClass())
|
||||
@@ -52,7 +51,7 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte
|
||||
];
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null)
|
||||
public function supportsNormalization($data, string $format = null)
|
||||
{
|
||||
return $data instanceof Notification && 'json' === $format;
|
||||
}
|
||||
|
@@ -33,8 +33,7 @@ class PhonenumberNormalizer implements ContextAwareNormalizerInterface, Denormal
|
||||
|
||||
/**
|
||||
* @param string|null $data
|
||||
* @param mixed $type
|
||||
* @param null|mixed $format
|
||||
* @param mixed|null $format
|
||||
*
|
||||
* @throws UnexpectedValueException
|
||||
*/
|
||||
@@ -51,7 +50,7 @@ class PhonenumberNormalizer implements ContextAwareNormalizerInterface, Denormal
|
||||
}
|
||||
}
|
||||
|
||||
public function normalize($object, ?string $format = null, array $context = []): string
|
||||
public function normalize($object, string $format = null, array $context = []): string
|
||||
{
|
||||
if ('docgen' === $format && null === $object) {
|
||||
return '';
|
||||
@@ -65,7 +64,7 @@ class PhonenumberNormalizer implements ContextAwareNormalizerInterface, Denormal
|
||||
return 'libphonenumber\PhoneNumber' === $type;
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||
public function supportsNormalization($data, string $format = null, array $context = []): bool
|
||||
{
|
||||
if ($data instanceof PhoneNumber && 'json' === $format) {
|
||||
return true;
|
||||
|
@@ -15,18 +15,15 @@ use Chill\MainBundle\Doctrine\Model\Point;
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
|
||||
use function count;
|
||||
use function is_array;
|
||||
|
||||
class PointNormalizer implements DenormalizerInterface
|
||||
{
|
||||
public function denormalize($data, $type, $format = null, array $context = [])
|
||||
{
|
||||
if (!is_array($data)) {
|
||||
if (!\is_array($data)) {
|
||||
throw new InvalidArgumentException('point data is not an array. It should be an array of 2 coordinates.');
|
||||
}
|
||||
|
||||
if (count($data) !== 2) {
|
||||
if (2 !== \count($data)) {
|
||||
throw new InvalidArgumentException('point data is not an array of 2 elements. It should be an array of 2 coordinates.');
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, Denorma
|
||||
{
|
||||
public function __construct(private readonly Security $security) {}
|
||||
|
||||
public function denormalize($data, string $type, ?string $format = null, array $context = []): PrivateCommentEmbeddable
|
||||
public function denormalize($data, string $type, string $format = null, array $context = []): PrivateCommentEmbeddable
|
||||
{
|
||||
$comment = new PrivateCommentEmbeddable();
|
||||
|
||||
@@ -38,12 +38,12 @@ class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, Denorma
|
||||
return $object->getCommentForUser($this->security->getUser());
|
||||
}
|
||||
|
||||
public function supportsDenormalization($data, string $type, ?string $format = null): bool
|
||||
public function supportsDenormalization($data, string $type, string $format = null): bool
|
||||
{
|
||||
return PrivateCommentEmbeddable::class === $type;
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null): bool
|
||||
public function supportsNormalization($data, string $format = null): bool
|
||||
{
|
||||
return $data instanceof PrivateCommentEmbeddable;
|
||||
}
|
||||
|
Reference in New Issue
Block a user