Preprocessor::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 2
crap 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Foo\Pdo\Statement;
6
7
class Preprocessor implements IPreprocessor
8
{
9
    /** @var IPreprocessor[] */
10
    protected $preprocessors = [];
11
12
    /**
13
     * Preprocessor constructor.
14
     *
15
     * @param IPreprocessor[] ...$preprocessors
16
     */
17 1
    public function __construct(IPreprocessor ...$preprocessors)
18
    {
19 1
        $this->preprocessors = $preprocessors;
0 ignored issues
show
Documentation Bug introduced by
It seems like $preprocessors of type array<integer,array<inte...tement\IPreprocessor>>> is incompatible with the declared type array<integer,object<Foo...atement\IPreprocessor>> of property $preprocessors.

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 1
    }
21
22
    /**
23
     * @param string $query
24
     * @param array  $parameters
25
     */
26 1
    public function process(string &$query, array &$parameters)
27
    {
28 1
        foreach ($this->preprocessors as $preprocessor) {
29 1
            $preprocessor->process($query, $parameters);
30
        }
31
32 1
        return true;
33
    }
34
}
35