Passed
Pull Request — master (#32)
by Baptiste
02:15
created

BehapiFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createMatcher() 0 10 2
1
<?php
2
namespace Behapi\Tools;
3
4
use Coduo\PHPMatcher\Matcher;
5
use Coduo\PHPMatcher\Factory\SimpleFactory;
6
7
/**
8
 * Removes the chain matcher, use only the JsonMatcher
9
 *
10
 * @author Baptiste Clavié <[email protected]>
11
 */
12
class BehapiFactory extends SimpleFactory
13
{
14
    /** @var JsonMatcher */
15
    private $matcher;
16
17
    /** {@inheritDoc} */
18
    public function createMatcher()
19
    {
20
        if (null === $this->matcher) {
21
            $orMatcher = $this->buildOrMatcher();
22
23
            $this->matcher = new Matcher\JsonMatcher($orMatcher);
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Coduo\PHPMatcher\Ma...JsonMatcher($orMatcher) of type object<Coduo\PHPMatcher\Matcher\JsonMatcher> is incompatible with the declared type object<Behapi\Tools\JsonMatcher> of property $matcher.

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...
24
        }
25
26
        return new Matcher($this->matcher);
27
    }
28
}
29