Skip to content

Commit

Permalink
ENH Add generic types
Browse files Browse the repository at this point in the history
There are also a few general corrections to PHPDocs that I noticed along
the way (e.g. adding `|null` when the method is returning a null value.

There are some cases where either the return type or the whole PHPDoc
was duplicated from the parent class - in those cases I've simply
removed the duplication.
  • Loading branch information
GuySartorelli committed Jan 10, 2024
1 parent 524e27f commit 762822d
Show file tree
Hide file tree
Showing 18 changed files with 210 additions and 182 deletions.
20 changes: 8 additions & 12 deletions src/ORM/ArrayList.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
* - sort
* - filter
* - exclude
*
* @template T
* @implements SS_List<T>
* @implements Filterable<T>
* @implements Sortable<T>
* @implements Limitable<T>
*/
class ArrayList extends ViewableData implements SS_List, Filterable, Sortable, Limitable
{
Expand Down Expand Up @@ -116,6 +122,8 @@ public function exists()
/**
* Returns an Iterator for this ArrayList.
* This function allows you to use ArrayList in foreach loops
*
* @return Traversable<T>
*/
public function getIterator(): Traversable
{
Expand All @@ -130,8 +138,6 @@ public function getIterator(): Traversable

/**
* Return an array of the actual items that this ArrayList contains.
*
* @return array
*/
public function toArray()
{
Expand Down Expand Up @@ -342,11 +348,6 @@ public function shift()
return array_shift($this->items);
}

/**
* Returns the first item in the list
*
* @return mixed
*/
public function first()
{
if (empty($this->items)) {
Expand All @@ -356,11 +357,6 @@ public function first()
return reset($this->items);
}

/**
* Returns the last item in the list
*
* @return mixed
*/
public function last()
{
if (empty($this->items)) {
Expand Down
Loading

0 comments on commit 762822d

Please sign in to comment.