php csfixes

This commit is contained in:
2022-05-04 13:00:46 +02:00
parent 416a88b93d
commit e19cac168b
12 changed files with 136 additions and 138 deletions

View File

@@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Chill\MainBundle\Serializer\Normalizer;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
@@ -19,7 +18,6 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, DenormalizerInterface
{
private Security $security;
public function __construct(Security $security)
@@ -40,19 +38,18 @@ class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, Denorma
return $comment;
}
public function supportsDenormalization($data, string $type, ?string $format = null): bool
{
return $type === PrivateCommentEmbeddable::class;
}
public function normalize($comment, $format = null, array $contect = []): string
{
return $comment->getCommentForUser($this->security->getUser());
}
public function supportsDenormalization($data, string $type, ?string $format = null): bool
{
return PrivateCommentEmbeddable::class === $type;
}
public function supportsNormalization($data, ?string $format = null): bool
{
return $data instanceof PrivateCommentEmbeddable;
}
}
}