LinearUnit: Make Iterator methods compatible with the parent methods

This commit is contained in:
Yonas Habteab 2022-05-30 14:01:30 +02:00
parent 4782df4fee
commit 8e6d4a6b46
1 changed files with 5 additions and 3 deletions

View File

@ -124,6 +124,7 @@ class LinearUnit implements AxisUnit
*
* @return int
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->currentTick;
@ -132,7 +133,7 @@ class LinearUnit implements AxisUnit
/**
* Calculate the next tick and tick value
*/
public function next()
public function next(): void
{
$this->currentTick += (100 / $this->nrOfTicks);
$this->currentValue += (($this->max - $this->min) / $this->nrOfTicks);
@ -143,6 +144,7 @@ class LinearUnit implements AxisUnit
*
* @return string The label for the current tick
*/
#[\ReturnTypeWillChange]
public function key()
{
return (string) intval($this->currentValue);
@ -153,7 +155,7 @@ class LinearUnit implements AxisUnit
*
* @return bool
*/
public function valid()
public function valid(): bool
{
return $this->currentTick >= 0 && $this->currentTick <= 100;
}
@ -161,7 +163,7 @@ class LinearUnit implements AxisUnit
/**
* Reset the current tick and label value
*/
public function rewind()
public function rewind(): void
{
$this->currentTick = 0;
$this->currentValue = $this->min;