Completed
Push — master ( 50a607...8ceb96 )
by Iman
16:20 queued 12:39
created

ViewSituations::whenYouMakeView()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Imanghafoori\HeyMan\Situations;
4
5
use Imanghafoori\HeyMan\Normilizers\ViewNormalizer;
6
use Imanghafoori\HeyMan\WatchingStrategies\ViewEventManager;
7
use Imanghafoori\HeyMan\YouShouldHave;
8
9
class ViewSituations extends BaseSituation
10
{
11
    use ViewNormalizer;
12
13
    /**
14
     * @param array|string $views
15
     *
16
     * @return YouShouldHave
17
     */
18 19
    public function whenYouMakeView(...$views): YouShouldHave
19
    {
20 19
        return $this->watchView($this->normalizeView($views));
21
    }
22
23 18
    private function watchView($view): YouShouldHave
24
    {
25 18
        $this->chain->eventManager = app(ViewEventManager::class)->init($view);
0 ignored issues
show
Documentation Bug introduced by
It seems like app(Imanghafoori\HeyMan\...er::class)->init($view) of type Imanghafoori\HeyMan\Watc...tegies\ViewEventManager is incompatible with the declared type Imanghafoori\HeyMan\ListenerApplier of property $eventManager.

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...
26
27 18
        return app(YouShouldHave::class);
28
    }
29
}
30