Skip to content

Commit cad3938

Browse files
committed
some doc comment improvements (closes #10)
1 parent ae3cd1d commit cad3938

File tree

4 files changed

+37
-47
lines changed

4 files changed

+37
-47
lines changed

src/PhpCollection/AbstractMap.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
/**
2525
* A simple map implementation which basically wraps an array with an object oriented interface.
2626
*
27-
* @IgnoreAnnotation("template")
28-
* @template {K extends string} This implementation only supports strings as keys.
29-
*
3027
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
3128
*/
3229
class AbstractMap extends AbstractCollection implements \IteratorAggregate, MapInterface
@@ -57,7 +54,7 @@ public function exists($callable)
5754
/**
5855
* Sets all key/value pairs in the map.
5956
*
60-
* @param array<string,T> $kvMap
57+
* @param array $kvMap
6158
*
6259
* @return void
6360
*/

src/PhpCollection/AbstractSequence.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,14 @@
3131
*
3232
* This sequence is mutable.
3333
*
34-
* @IgnoreAnnotation("template")
35-
* @template T The type that this sequence contains.
36-
*
3734
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
3835
*/
3936
class AbstractSequence extends AbstractCollection implements \IteratorAggregate, SequenceInterface
4037
{
4138
protected $elements;
4239

4340
/**
44-
* @param array<T> $elements
41+
* @param array $elements
4542
*/
4643
public function __construct(array $elements = array())
4744
{
@@ -289,7 +286,7 @@ public function take($number)
289286
*
290287
* @param callable $callable receives elements of this sequence as first argument, and returns true/false.
291288
*
292-
* @return Sequence<T>
289+
* @return Sequence
293290
*/
294291
public function takeWhile($callable)
295292
{

src/PhpCollection/MapInterface.php

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,21 @@
2323
/**
2424
* Basic map interface.
2525
*
26-
* @IgnoreAnnotation("template")
27-
* @template K the type of the keys
28-
* @template V the type of the values
29-
*
3026
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
3127
*/
3228
interface MapInterface extends CollectionInterface
3329
{
3430
/**
3531
* Returns the first element in the collection if available.
3632
*
37-
* @return Option<array<K,V>>
33+
* @return Option on array<K,V>
3834
*/
3935
public function first();
4036

4137
/**
4238
* Returns the last element in the collection if available.
4339
*
44-
* @return Option<array<K,V>>
40+
* @return Option on array<K,V>
4541
*/
4642
public function last();
4743

@@ -50,23 +46,23 @@ public function last();
5046
*
5147
* @param callable $callable receives the element as first argument, and returns true, or false
5248
*
53-
* @return Option<array<K,V>>
49+
* @return Option on array<K,V>
5450
*/
5551
public function find($callable);
5652

5753
/**
5854
* Returns the value associated with the given key.
5955
*
60-
* @param K $key
56+
* @param mixed $key
6157
*
62-
* @return Option<V>
58+
* @return Option on V
6359
*/
6460
public function get($key);
6561

6662
/**
6763
* Returns whether this map contains a given key.
6864
*
69-
* @param K $key
65+
* @param mixed $key
7066
*
7167
* @return boolean
7268
*/
@@ -75,8 +71,8 @@ public function containsKey($key);
7571
/**
7672
* Puts a new element in the map.
7773
*
78-
* @param K $key
79-
* @param V $value
74+
* @param mixed $key
75+
* @param mixed $value
8076
*
8177
* @return void
8278
*/
@@ -85,32 +81,32 @@ public function set($key, $value);
8581
/**
8682
* Removes an element from the map.
8783
*
88-
* @param K $key
84+
* @param mixed $key
8985
*
90-
* @return V
86+
* @return mixed
9187
*/
9288
public function remove($key);
9389

9490
/**
9591
* Adds all another map to this map, and returns itself.
9692
*
97-
* @param MapInterface<K,V> $map
93+
* @param MapInterface $map
9894
*
99-
* @return MapInterface<K,V>
95+
* @return MapInterface
10096
*/
10197
public function addMap(MapInterface $map);
10298

10399
/**
104100
* Returns an array with the keys.
105101
*
106-
* @return array<K>
102+
* @return array
107103
*/
108104
public function keys();
109105

110106
/**
111107
* Returns an array with the values.
112108
*
113-
* @return array<V>
109+
* @return array
114110
*/
115111
public function values();
116112

@@ -121,7 +117,7 @@ public function values();
121117
*
122118
* @param integer $number
123119
*
124-
* @return MapInterface<K,V>
120+
* @return MapInterface
125121
*/
126122
public function drop($number);
127123

@@ -132,7 +128,7 @@ public function drop($number);
132128
*
133129
* @param integer $number
134130
*
135-
* @return MapInterface<K,V>
131+
* @return MapInterface
136132
*/
137133
public function dropRight($number);
138134

@@ -141,7 +137,7 @@ public function dropRight($number);
141137
*
142138
* @param callable $callable Receives the element to drop as first argument, and returns true (drop), or false (stop).
143139
*
144-
* @return MapInterface<K,V>
140+
* @return MapInterface
145141
*/
146142
public function dropWhile($callable);
147143

@@ -154,7 +150,7 @@ public function dropWhile($callable);
154150
*
155151
* @param integer $number
156152
*
157-
* @return MapInterface<K,V>
153+
* @return MapInterface
158154
*/
159155
public function take($number);
160156

@@ -164,7 +160,7 @@ public function take($number);
164160
*
165161
* @param callable $callable
166162
*
167-
* @return MapInterface<K,V>
163+
* @return MapInterface
168164
*/
169165
public function takeWhile($callable);
170166
}

src/PhpCollection/SequenceInterface.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,37 @@ interface SequenceInterface extends CollectionInterface
3232
/**
3333
* Returns the first element in the collection if available.
3434
*
35-
* @return Option<T>
35+
* @return Option
3636
*/
3737
public function first();
3838

3939
/**
4040
* Returns the last element in the collection if available.
4141
*
42-
* @return Option<T>
42+
* @return Option
4343
*/
4444
public function last();
4545

4646
/**
4747
* Returns all elements in this sequence.
4848
*
49-
* @return array<T>
49+
* @return array
5050
*/
5151
public function all();
5252

5353
/**
5454
* Adds the elements of another sequence to this sequence.
5555
*
56-
* @param SequenceInterface<T> $seq
56+
* @param SequenceInterface $seq
5757
*
58-
* @return SequenceInterface<T>
58+
* @return SequenceInterface
5959
*/
6060
public function addSequence(SequenceInterface $seq);
6161

6262
/**
6363
* Returns the index of the passed element.
6464
*
65-
* @param T $elem
65+
* @param mixed $elem
6666
*
6767
* @return integer the index (0-based), or -1 if not found
6868
*/
@@ -71,7 +71,7 @@ public function indexOf($elem);
7171
/**
7272
* Returns the last index of the passed element.
7373
*
74-
* @param T $elem
74+
* @param mixed $elem
7575
* @return integer the index (0-based), or -1 if not found
7676
*/
7777
public function lastIndexOf($elem);
@@ -105,7 +105,7 @@ public function lastIndexWhere($callable);
105105
/**
106106
* Returns all indices of this collection.
107107
*
108-
* @return array<integer>
108+
* @return integer[]
109109
*/
110110
public function indices();
111111

@@ -114,14 +114,14 @@ public function indices();
114114
*
115115
* @param integer $index (0-based)
116116
*
117-
* @return T
117+
* @return mixed
118118
*/
119119
public function get($index);
120120

121121
/**
122122
* Adds an element to the sequence.
123123
*
124-
* @param T $elem
124+
* @param mixed $elem
125125
*
126126
* @return void
127127
*/
@@ -132,14 +132,14 @@ public function add($elem);
132132
*
133133
* @param integer $index
134134
*
135-
* @return T
135+
* @return mixed
136136
*/
137137
public function remove($index);
138138

139139
/**
140140
* Adds all elements to the sequence.
141141
*
142-
* @param array<T> $elements
142+
* @param array $elements
143143
*
144144
* @return void
145145
*/
@@ -149,7 +149,7 @@ public function addAll(array $elements);
149149
* Updates the value at the given index.
150150
*
151151
* @param integer $index
152-
* @param T $value
152+
* @param mixed $value
153153
*
154154
* @return void
155155
*/
@@ -195,7 +195,7 @@ public function dropWhile($callable);
195195
*
196196
* @param integer $number
197197
*
198-
* @return CollectionInterface<T>
198+
* @return CollectionInterface
199199
*/
200200
public function take($number);
201201

@@ -205,7 +205,7 @@ public function take($number);
205205
*
206206
* @param callable $callable
207207
*
208-
* @return CollectionInterface<T>
208+
* @return CollectionInterface
209209
*/
210210
public function takeWhile($callable);
211211

0 commit comments

Comments
 (0)