Passed
Pull Request — master (#8)
by Nikolay
02:45
created

LegacyObjectNormalizer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 4
c 1
b 0
f 0
dl 0
loc 8
ccs 3
cts 4
cp 0.75
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Normalizer;
6
7
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
8
9
class LegacyObjectNormalizer extends ObjectNormalizer
10
{
11 94
    public function normalize($object, $format = null, array $context = [])
12
    {
13 94
        $data = parent::normalize($object, $format, $context);
14
15
        return \array_filter($data, static function ($value) {
0 ignored issues
show
Bug introduced by
It seems like $data can also be of type ArrayObject; however, parameter $input of array_filter() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

15
        return \array_filter(/** @scrutinizer ignore-type */ $data, static function ($value) {
Loading history...
16 86
            return null !== $value;
17 94
        });
18
    }
19
}
20