|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Tidal/WampWatch package. |
|
5
|
|
|
* (c) 2016 Timo Michna <timomichna/yahoo.de> |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
* |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Tidal\WampWatch\Behavior\Async; |
|
13
|
|
|
|
|
14
|
|
|
use Tidal\WampWatch\Async\DeferredInterface; |
|
15
|
|
|
use Tidal\WampWatch\Async\Adapter\DeferredFactoryInterface; |
|
16
|
|
|
use Tidal\WampWatch\Async\DefaultDeferredFactory; |
|
17
|
|
|
use Tidal\WampWatch\Async\Adapter\PromiseFactoryInterface; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Trait Tidal\WampWatch\Behavior\Async\MakesDeferredPromisesTrait. |
|
21
|
|
|
*/ |
|
22
|
|
|
trait MakesDeferredPromisesTrait |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* @var DeferredFactoryInterface |
|
26
|
|
|
*/ |
|
27
|
|
|
private $deferredFactory; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @param callable|null $canceller |
|
31
|
|
|
* |
|
32
|
|
|
* @return DeferredInterface |
|
33
|
|
|
*/ |
|
34
|
|
|
protected function createDeferred(callable $canceller = null) |
|
35
|
|
|
{ |
|
36
|
|
|
return $this->getDeferredFactory()->create($canceller); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @param DeferredFactoryInterface $deferredFactory |
|
41
|
|
|
*/ |
|
42
|
|
|
public function setDeferredFactory($deferredFactory) |
|
43
|
|
|
{ |
|
44
|
|
|
$this->deferredFactory = $deferredFactory; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @return DeferredFactoryInterface |
|
49
|
|
|
*/ |
|
50
|
|
|
public function getDeferredFactory() |
|
51
|
|
|
{ |
|
52
|
|
|
if (!isset($this->deferredFactory)) { |
|
53
|
|
|
$this->deferredFactory = new DefaultDeferredFactory( |
|
|
|
|
|
|
54
|
|
|
$this->getPromiseFactory() |
|
55
|
|
|
); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
return $this->deferredFactory; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Dependency on MakesPromisesTrait. |
|
63
|
|
|
* |
|
64
|
|
|
* @return PromiseFactoryInterface |
|
65
|
|
|
*/ |
|
66
|
|
|
abstract public function getPromiseFactory(); |
|
67
|
|
|
} |
|
68
|
|
|
|
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..