Completed
Push — master ( b66861...585d80 )
by René
04:01
created

PageRule::check()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 7
cp 0
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Zortje\SEO;
4
5
use Zortje\Rules\ResultCollection;
6
use Zortje\Rules\RuleCollection;
7
use Zortje\Rules\RuleInterface;
8
use Zortje\Rules\Subject;
9
use Zortje\SEO\Page\ImageRule;
10
use Zortje\SEO\Page\TitleRule;
11
12
/**
13
 * Class PageRule
14
 *
15
 * @package Zortje\SEO
16
 */
17
class PageRule implements RuleInterface
18
{
19
20
    /**
21
     * Check page rules
22
     *
23
     * @param Subject $subject
24
     *
25
     * @return ResultCollection
26
     */
27
    public function check(Subject $subject): ResultCollection
28
    {
29
        $ruleCollection = new RuleCollection();
30
31
        $ruleCollection->add(new TitleRule());
32
        $ruleCollection->add(new ImageRule());
0 ignored issues
show
Documentation introduced by
new \Zortje\SEO\Page\ImageRule() is of type object<Zortje\SEO\Page\ImageRule>, but the function expects a object<Zortje\Rules\RuleInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
33
34
        return $ruleCollection->check($subject);
35
    }
36
}
37