apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -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']]
)
);
}