mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user