(Calender|Logarithmic)Unit: Define return type of overridden methods from `Iterator` interface

This commit is contained in:
Sukhwinder Dhillon 2023-08-15 16:57:08 +02:00 committed by raviks789
parent 2e7d6b43e5
commit 1271aa8480
2 changed files with 10 additions and 10 deletions

View File

@ -124,7 +124,7 @@ class CalendarUnit extends LinearUnit
* *
* @return int The position of the next tick (between 0 and 100) * @return int The position of the next tick (between 0 and 100)
*/ */
public function current() public function current(): int
{ {
return 100 * (key($this->labels) / count($this->labels)); return 100 * (key($this->labels) / count($this->labels));
} }
@ -132,7 +132,7 @@ class CalendarUnit extends LinearUnit
/** /**
* Move to next tick * Move to next tick
*/ */
public function next() public function next(): void
{ {
next($this->labels); next($this->labels);
} }
@ -142,7 +142,7 @@ class CalendarUnit extends LinearUnit
* *
* @return string * @return string
*/ */
public function key() public function key(): string
{ {
return current($this->labels); return current($this->labels);
} }
@ -152,7 +152,7 @@ class CalendarUnit extends LinearUnit
* *
* @return bool * @return bool
*/ */
public function valid() public function valid(): bool
{ {
return current($this->labels) !== false; return current($this->labels) !== false;
} }
@ -160,7 +160,7 @@ class CalendarUnit extends LinearUnit
/** /**
* Rewind the internal array * Rewind the internal array
*/ */
public function rewind() public function rewind(): void
{ {
reset($this->labels); reset($this->labels);
} }

View File

@ -111,7 +111,7 @@ class LogarithmicUnit implements AxisUnit
* *
* @return int * @return int
*/ */
public function current() public function current(): int
{ {
return $this->currentTick * (100 / $this->getTicks()); return $this->currentTick * (100 / $this->getTicks());
} }
@ -119,7 +119,7 @@ class LogarithmicUnit implements AxisUnit
/** /**
* Calculate the next tick and tick value * Calculate the next tick and tick value
*/ */
public function next() public function next(): void
{ {
++ $this->currentTick; ++ $this->currentTick;
} }
@ -129,7 +129,7 @@ class LogarithmicUnit implements AxisUnit
* *
* @return string The label for the current tick * @return string The label for the current tick
*/ */
public function key() public function key(): string
{ {
$currentBase = $this->currentTick + $this->minExp; $currentBase = $this->currentTick + $this->minExp;
if (abs($currentBase) > 4) { if (abs($currentBase) > 4) {
@ -143,7 +143,7 @@ class LogarithmicUnit implements AxisUnit
* *
* @return bool * @return bool
*/ */
public function valid() public function valid(): bool
{ {
return $this->currentTick >= 0 && $this->currentTick < $this->getTicks(); return $this->currentTick >= 0 && $this->currentTick < $this->getTicks();
} }
@ -151,7 +151,7 @@ class LogarithmicUnit implements AxisUnit
/** /**
* Reset the current tick and label value * Reset the current tick and label value
*/ */
public function rewind() public function rewind(): void
{ {
$this->currentTick = 0; $this->currentTick = 0;
} }