Completed
Push — master ( 0918de...c6b316 )
by BENOIT
01:36
created

ArrayValuesNormalizerRenderer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace BenTools\QueryString\Renderer;
4
5
use BenTools\QueryString\QueryString;
6
7
final class ArrayValuesNormalizerRenderer implements QueryStringRendererInterface
8
{
9
    /**
10
     * @var NativeRenderer
11
     */
12
    private $renderer;
13
14
    /**
15
     * ArrayValuesStringifier constructor.
16
     */
17
    public function __construct(QueryStringRendererInterface $renderer = null)
18
    {
19
        $this->renderer = $renderer ?? NativeRenderer::rfc3986();
0 ignored issues
show
Documentation Bug introduced by
It seems like $renderer ?? \BenTools\Q...tiveRenderer::rfc3986() of type object<BenTools\QueryStr...tringRendererInterface> or object<self> is incompatible with the declared type object<BenTools\QueryStr...enderer\NativeRenderer> of property $renderer.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
20
    }
21
22
    /**
23
     * @inheritDoc
24
     */
25
    public function render(QueryString $queryString): string
26
    {
27
        return preg_replace(
28
            '/\%5B\d+\%5D/',
29
            '%5B%5D',
30
            $this->renderer->render($queryString)
31
        );
32
    }
33
}
34