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

LegacyObjectNormalizer::normalize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.0156

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 4
cp 0.75
rs 10
cc 1
nc 1
nop 3
crap 1.0156
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