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