1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the bee4/events package. |
4
|
|
|
* For the full copyright and license information, please view the LICENSE |
5
|
|
|
* file that was distributed with this source code. |
6
|
|
|
* |
7
|
|
|
* @copyright Bee4 2014 |
8
|
|
|
* @author Stephane HULARD <[email protected]> |
9
|
|
|
* @package Bee4\Events\Adapters |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Bee4\Events\Adapters; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\EventDispatcher\EventDispatcher; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Bridge to the Symfony EventDispatcher implementation |
18
|
|
|
* @see https://github.com/symfony/EventDispatcher |
19
|
|
|
* @package BeeBot\Event\Adapters |
20
|
|
|
*/ |
21
|
|
|
class SymfonyEventDispatcherAdapter extends AbstractDispatcherAdapter |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* Adapted dispatcher |
25
|
|
|
* @var Symfony\Component\EventDispatcher\EventDispatcher |
26
|
|
|
*/ |
27
|
|
|
protected $dispatcher; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param Symfony\Component\EventDispatcher\EventDispatcher $dispatcher |
31
|
|
|
*/ |
32
|
|
|
public function __construct(EventDispatcher $dispatcher) |
33
|
|
|
{ |
34
|
|
|
$this->dispatcher = $dispatcher; |
|
|
|
|
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @see AbstractDispatcherAdapter::add |
39
|
|
|
*/ |
40
|
|
|
public function add($name, callable $listener, $priority = 0) |
41
|
|
|
{ |
42
|
1 |
|
$this->dispatcher->addListener($name, $listener, $priority); |
43
|
1 |
|
return $this; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @see AbstractDispatcherAdapter::remove |
48
|
|
|
*/ |
49
|
|
|
public function remove($name, callable $listener) |
50
|
|
|
{ |
51
|
1 |
|
$this->dispatcher->removeListener($name, $listener); |
52
|
1 |
|
return $this; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @see AbstractDispatcherAdapter::get |
57
|
|
|
*/ |
58
|
|
|
public function get($name) |
59
|
|
|
{ |
60
|
1 |
|
return $this->dispatcher->getListeners($name); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
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..