Skip to content

Commit 9317e13

Browse files
Merge pull request #32 from quant-php/dev
refactor: update docblocks and minor variable naming changes
2 parents 0a96a93 + 6c6081a commit 9317e13

File tree

1 file changed

+4
-44
lines changed

1 file changed

+4
-44
lines changed

src/Quant/Core/AbstractList.php

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323
use TypeError;
2424

2525
/**
26-
* List supporting Generic types.
27-
* Each class deriving from AbstractList must provide information about the type maintained
28-
* with instances of this list via `getType`.
29-
* In addition to the interfaces implemented by this class, additional methods are provided
30-
* that help with filtering or looking up entries: #findBy, #peek#, #map
31-
*
3226
* @template TValue
3327
* @implements Iterator<int, TValue>
3428
* @implements ArrayAccess<int, TValue>
@@ -47,20 +41,12 @@ abstract class AbstractList implements Arrayable, ArrayAccess, Iterator, Countab
4741
protected int $position = 0;
4842

4943

50-
/**
51-
* Constructor.
52-
* Final to allow new static();
53-
*
54-
* @see make
55-
*/
5644
final public function __construct()
5745
{
5846
}
5947

6048

6149
/**
62-
* Factory method for easily creating instances of the implementing class.
63-
*
6450
* @param mixed ...$items
6551
*
6652
* @return static
@@ -77,20 +63,11 @@ public static function make(...$items): static
7763
}
7864

7965

80-
/**
81-
* Returns the class name of the entity-type this list should maintain
82-
* entries of.
83-
*
84-
* @return string
85-
*/
8666
abstract public function getType(): string;
8767

8868

8969
/**
90-
* Applies the map function to this data and returns **this** list.
91-
*
92-
* @param callable $mapFn The callable to pass to the callback submitted to
93-
* array_map()
70+
* @param callable $mapFn
9471
*
9572
* @return static
9673
*/
@@ -103,11 +80,7 @@ public function map(callable $mapFn): static
10380

10481

10582
/**
106-
* Returns a new AbstractList containing all the entries for which the callable returned `true`.
107-
* Returns null if no matches were found.
108-
*
109-
* @param callable $findFn A callback. Return true in the function to indicate a match. First match will
110-
* be returned. The callback is passed the current entry.
83+
* @param callable $findFn
11184
*
11285
* @return null|static
11386
*/
@@ -125,8 +98,6 @@ public function findBy(callable $findFn): null|static
12598

12699

127100
/**
128-
* Returns the element at the head of the AbstractList, or null if the list is empty.
129-
*
130101
* @return ?TValue
131102
*/
132103
public function peek(): mixed
@@ -176,17 +147,9 @@ public function equals(Equatable $target): bool
176147
}
177148

178149

179-
/**
180-
* Method called by the abstract list if containing items are neither Equatable nor Comparable.
181-
* Override to implement comparator.
182-
*
183-
* @param mixed $a
184-
* @param mixed $b
185-
* @return bool
186-
*/
187-
protected function compareItems(mixed $a, mixed $b): bool
150+
protected function compareItems(mixed $lft, mixed $rgt): bool
188151
{
189-
return $a === $b;
152+
return $lft === $rgt;
190153
}
191154

192155
/**
@@ -213,9 +176,6 @@ private function doInsert(mixed $offset, mixed $value)
213176
}
214177

215178
/**
216-
* @param mixed $value
217-
* @return bool
218-
*
219179
* @throws TypeError
220180
*/
221181
private function assertTypeFor(mixed $value): bool

0 commit comments

Comments
 (0)