Passed
Pull Request — main (#92)
by Niels
01:59
created

ProblemExceptionNormalizer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the OpenapiBundle package.
7
 *
8
 * (c) Niels Nijens <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Nijens\OpenapiBundle\ExceptionHandling\Normalizer;
15
16
use ArrayObject;
17
use Nijens\OpenapiBundle\NijensOpenapiBundle;
18
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
19
20
/*
21
 * Normalizes a {@see Throwable} implementing the {@see ProblemExceptionInterface}.
22
 *
23
 * @author Niels Nijens <[email protected]>
24
 */
25
if (NijensOpenapiBundle::getSymfonyVersion() < 70000) {
26
    final class ProblemExceptionNormalizer extends AbstractProblemExceptionNormalizer implements NormalizerInterface, NormalizerAwareInterface
27
    {
28
        /**
29
         * @return array
30
         */
31
        public function normalize($object, $format = null, array $context = [])
32
        {
33
            return $this->doNormalize($object, $format, $context);
34
        }
35
    }
36
} else {
37
    final class ProblemExceptionNormalizer extends AbstractProblemExceptionNormalizer implements NormalizerInterface, NormalizerAwareInterface
38
    {
39
        public function normalize($object, $format = null, array $context = []): float|int|bool|ArrayObject|array|string|null
40
        {
41
            return $this->doNormalize($object, $format, $context);
42
        }
43
    }
44
}
45