Completed
Push — master ( 3c1051...50a607 )
by Iman
09:32
created

EventSituations::whenEventHappens()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Imanghafoori\HeyMan\Situations;
4
5
use Imanghafoori\HeyMan\WatchingStrategies\EventManager;
6
use Imanghafoori\HeyMan\YouShouldHave;
7
8
class EventSituations extends BaseSituation
9
{
10
    /**
11
     * @param mixed ...$event
12
     *
13
     * @return YouShouldHave
14
     */
15
    public function whenEventHappens(...$event): YouShouldHave
16
    {
17
        return $this->watchEvents($this->normalizeInput($event));
18
    }
19
20
    /**
21
     * @param $eventName
22
     *
23
     * @return YouShouldHave
24
     */
25
    private function watchEvents($eventName): YouShouldHave
26
    {
27
        $this->chain->eventManager = app(EventManager::class)->init($eventName);
0 ignored issues
show
Documentation Bug introduced by
It seems like app(Imanghafoori\HeyMan\...lass)->init($eventName) of type Imanghafoori\HeyMan\Watc...Strategies\EventManager 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...
28
29
        return app(YouShouldHave::class);
30
    }
31
}