mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -14,14 +14,11 @@ namespace Chill\DocGeneratorBundle\Serializer\Helper;
|
||||
use Symfony\Component\Serializer\Mapping\ClassMetadata;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
use function array_merge;
|
||||
use function is_array;
|
||||
|
||||
class NormalizeNullValueHelper
|
||||
{
|
||||
public function __construct(private readonly NormalizerInterface $normalizer, private readonly ?string $discriminatorType = null, private readonly ?string $discriminatorValue = null) {}
|
||||
|
||||
public function normalize(array $attributes, string $format = 'docgen', ?array $context = [], ?ClassMetadata $classMetadata = null)
|
||||
public function normalize(array $attributes, string $format = 'docgen', ?array $context = [], ClassMetadata $classMetadata = null)
|
||||
{
|
||||
$data = [];
|
||||
$data['isNull'] = true;
|
||||
@@ -36,7 +33,7 @@ class NormalizeNullValueHelper
|
||||
} else {
|
||||
$data[$key] = match ($class) {
|
||||
'array', 'bool', 'double', 'float', 'int', 'resource', 'string', 'null' => '',
|
||||
default => $this->normalizer->normalize(null, $format, array_merge(
|
||||
default => $this->normalizer->normalize(null, $format, \array_merge(
|
||||
$this->getContextForAttribute($key, $context, $classMetadata),
|
||||
['docgen:expects' => $class]
|
||||
)),
|
||||
@@ -57,10 +54,10 @@ class NormalizeNullValueHelper
|
||||
|
||||
if (null !== $attributeMetadata) {
|
||||
/** @var \Symfony\Component\Serializer\Mapping\AttributeMetadata $attributeMetadata */
|
||||
$initialContext = array_merge(
|
||||
$initialContext = \array_merge(
|
||||
$initialContext,
|
||||
$attributeMetadata->getNormalizationContextForGroups(
|
||||
is_array($initialContext['groups']) ? $initialContext['groups'] : [$initialContext['groups']]
|
||||
\is_array($initialContext['groups']) ? $initialContext['groups'] : [$initialContext['groups']]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user