Skip to content

Commit

Permalink
#30 fix return type
Browse files Browse the repository at this point in the history
  • Loading branch information
1stthomas committed Mar 10, 2022
1 parent 8a8fe2d commit 6149590
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/Lists/AbstractItemList.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,41 @@ abstract class AbstractItemList implements ItemListable
{

use CanRestrictInexVariables;

protected $items = [];

public function __construct(array $data = [])
{
$this->load($data);
}

/**
* {@inheritdoc}
*/
public abstract function add($item);

/**
* {@inheritdoc}
*/
public abstract function merge(ItemListable $iL);

/**
* {@inheritdoc}
*/
public function count()
public function count(): int
{
return count($this->getAll());
}

/**
* {@inheritdoc}
*/
public function get($index)
{
return $this->items[$index];
}

/**
* {@inheritdoc}
*/
public function getAll()
{
return $this->items;
}

/**
* Get an iterator.
*
Expand All @@ -73,39 +66,34 @@ public function getIterator()
{
return new SimpleIndexIterator($this->getAll());
}

/**
* {@inheritdoc}
*/
public function getNext($index)
{
return empty($index) ? null : $this->items[($index + 1)];
}

/**
* {@inheritdoc}
*/
public function getPrevious($index)
{
return empty($index) ? null : $this->items[($index - 1)];
}

/**
* {@inheritdoc}
*/
public function has($index)
{
return isset($this->items[$index]);
}

/**
* {@inheritdoc}
*/
public function hasByValue($compare)
{
return in_array($compare, $this->items);
}

/**
* {@inheritdoc}
*/
Expand All @@ -115,15 +103,13 @@ public function load(array $data)
$this->add($item);
}
}

/**
* {@inheritdoc}
*/
public function remove($index)
{
unset($this->items[$index]);
}

/**
* Throw an <code>InvalidArgumentException</code>.
*
Expand All @@ -136,5 +122,4 @@ protected function handleInvalidIndex($index)

throw new InvalidArgumentException($e);
}

}

0 comments on commit 6149590

Please sign in to comment.