1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
// This stub is created to support Psalm generics. |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Zend Framework (http://framework.zend.com/) |
7
|
|
|
* |
8
|
|
|
* @link http://github.com/zendframework/zf2 for the canonical source repository |
9
|
|
|
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
10
|
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Zend\Stdlib; |
14
|
|
|
|
15
|
|
|
use Countable; |
16
|
|
|
use IteratorAggregate; |
17
|
|
|
use Serializable; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @psalm-template T |
21
|
|
|
* @template-extends IteratorAggregate<int, T> |
22
|
|
|
* @template-extends ArrayAccess<int|null, T> |
23
|
|
|
*/ |
24
|
|
|
class PriorityQueue implements Countable, IteratorAggregate, Serializable |
25
|
|
|
{ |
26
|
|
|
const EXTR_DATA = 0x00000001; |
27
|
|
|
const EXTR_PRIORITY = 0x00000002; |
28
|
|
|
const EXTR_BOTH = 0x00000003; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @param mixed $data |
32
|
|
|
* @param int $priority |
33
|
|
|
* |
34
|
|
|
* @return PriorityQueue |
|
|
|
|
35
|
|
|
* |
36
|
|
|
* @psalm-param T $data |
37
|
|
|
* @psalm-return PriorityQueue<T> |
38
|
|
|
*/ |
39
|
|
|
public function insert($data, $priority = 1) { } |
|
|
|
|
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param mixed $datum |
43
|
|
|
* |
44
|
|
|
* @return bool False if the item was not found, true otherwise. |
|
|
|
|
45
|
|
|
* |
46
|
|
|
* @psalm-param T $datum |
47
|
|
|
*/ |
48
|
|
|
public function remove($datum) { } |
|
|
|
|
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @return bool |
|
|
|
|
52
|
|
|
*/ |
53
|
|
|
public function isEmpty() { } |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return int |
|
|
|
|
57
|
|
|
*/ |
58
|
|
|
public function count() { } |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return mixed |
62
|
|
|
*/ |
63
|
|
|
public function top() { } |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return mixed |
67
|
|
|
*/ |
68
|
|
|
public function extract() { } |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return SplPriorityQueue |
|
|
|
|
72
|
|
|
* |
73
|
|
|
* @psalm-return SplPriorityQueue<T> |
74
|
|
|
*/ |
75
|
|
|
public function getIterator() { } |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return string |
|
|
|
|
79
|
|
|
*/ |
80
|
|
|
public function serialize() { } |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param string $data |
84
|
|
|
* |
85
|
|
|
* @return void |
86
|
|
|
*/ |
87
|
|
|
public function unserialize($data) { } |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @param int $flag |
91
|
|
|
* |
92
|
|
|
* @return array |
|
|
|
|
93
|
|
|
*/ |
94
|
|
|
public function toArray($flag = self::EXTR_DATA) { } |
|
|
|
|
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param string $class |
98
|
|
|
* |
99
|
|
|
* @return PriorityQueue |
|
|
|
|
100
|
|
|
* |
101
|
|
|
* @psalm-return PriorityQueue<T> |
102
|
|
|
*/ |
103
|
|
|
public function setInternalQueueClass($class) { } |
|
|
|
|
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @param mixed $datum |
107
|
|
|
* |
108
|
|
|
* @return bool |
|
|
|
|
109
|
|
|
* |
110
|
|
|
* @psalm-param T $datum |
111
|
|
|
*/ |
112
|
|
|
public function contains($datum) { } |
|
|
|
|
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @param int $priority |
116
|
|
|
* |
117
|
|
|
* @return bool |
|
|
|
|
118
|
|
|
*/ |
119
|
|
|
public function hasPriority($priority) { } |
|
|
|
|
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return void |
123
|
|
|
*/ |
124
|
|
|
public function __clone() { } |
125
|
|
|
} |
126
|
|
|
|
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.