Skip to content

Commit

Permalink
added more types for php 8.1 compatibility, raised minimum php versio…
Browse files Browse the repository at this point in the history
…n to 7.1
  • Loading branch information
matthi4s committed Feb 10, 2022
1 parent b882ca0 commit 2fb7421
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 65 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": ">=7.0.0"
"php": ">=7.1.0"
},
"autoload": {
"psr-4": {
Expand Down
26 changes: 13 additions & 13 deletions src/Analysis/Analysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class Analysis implements AnalysisInterface
{
/**
* @var array
* @var InsightInterface[]
*/
protected $insights = [];

Expand All @@ -22,7 +22,7 @@ class Analysis implements AnalysisInterface
/**
* Set all insights at once in an array replacing the current insights
*
* @param array $insights
* @param InsightInterface[] $insights
* @return $this
*/
public function setInsights(array $insights = [])
Expand Down Expand Up @@ -103,7 +103,7 @@ public function getInformation(): array
*
* @return InsightInterface
*/
public function current()
public function current(): InsightInterface
{
return $this->insights[$this->iterator];
}
Expand All @@ -113,7 +113,7 @@ public function current()
*
* @return void
*/
public function next()
public function next(): void
{
$this->iterator++;
}
Expand All @@ -123,7 +123,7 @@ public function next()
*
* @return int
*/
public function key()
public function key(): int
{
return $this->iterator;
}
Expand All @@ -133,7 +133,7 @@ public function key()
*
* @return boolean
*/
public function valid()
public function valid(): bool
{
return array_key_exists($this->iterator, $this->insights);
}
Expand All @@ -143,7 +143,7 @@ public function valid()
*
* @return void
*/
public function rewind()
public function rewind(): void
{
$this->iterator = 0;
}
Expand All @@ -153,18 +153,18 @@ public function rewind()
*
* @return int
*/
public function count()
public function count(): int
{
return count($this->insights);
}

/**
* Whether a offset exists
* Whether an offset exists
*
* @param mixed $offset
* @return bool
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
return isset($this->result[$offset]);
}
Expand All @@ -175,7 +175,7 @@ public function offsetExists($offset)
* @param mixed $offset
* @return InsightInterface
*/
public function offsetGet($offset)
public function offsetGet($offset): InsightInterface
{
return $this->insights[$offset];
}
Expand All @@ -186,7 +186,7 @@ public function offsetGet($offset)
* @param $offset
* @param InsightInterface $value
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
$this->insights[$offset] = $value;
}
Expand All @@ -196,7 +196,7 @@ public function offsetSet($offset, $value)
*
* @param $offset
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
unset($this->insights[$offset]);
}
Expand Down
20 changes: 10 additions & 10 deletions src/Analysis/Problem.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function getSolutions(): array
*
* @return SolutionInterface
*/
public function current()
public function current(): SolutionInterface
{
return $this->solutions[$this->iterator];
}
Expand All @@ -68,7 +68,7 @@ public function current()
*
* @return void
*/
public function next()
public function next(): void
{
$this->iterator++;
}
Expand All @@ -78,7 +78,7 @@ public function next()
*
* @return int
*/
public function key()
public function key(): int
{
return $this->iterator;
}
Expand All @@ -88,7 +88,7 @@ public function key()
*
* @return boolean
*/
public function valid()
public function valid(): bool
{
return array_key_exists($this->iterator, $this->solutions);
}
Expand All @@ -98,7 +98,7 @@ public function valid()
*
* @return void
*/
public function rewind()
public function rewind(): void
{
$this->iterator = 0;
}
Expand All @@ -108,7 +108,7 @@ public function rewind()
*
* @return int
*/
public function count()
public function count(): int
{
return count($this->solutions);
}
Expand All @@ -119,7 +119,7 @@ public function count()
* @param mixed $offset
* @return bool
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
return isset($this->result[$offset]);
}
Expand All @@ -130,7 +130,7 @@ public function offsetExists($offset)
* @param mixed $offset
* @return SolutionInterface
*/
public function offsetGet($offset)
public function offsetGet($offset): SolutionInterface
{
return $this->solutions[$offset];
}
Expand All @@ -141,7 +141,7 @@ public function offsetGet($offset)
* @param $offset
* @param SolutionInterface $value
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
$this->solutions[$offset] = $value;
}
Expand All @@ -151,7 +151,7 @@ public function offsetSet($offset, $value)
*
* @param $offset
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
unset($this->solutions[$offset]);
}
Expand Down
30 changes: 15 additions & 15 deletions src/Log/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class Entry implements EntryInterface
{
/**
* @var array
* @var LineInterface[]
*/
protected $lines = [];

Expand All @@ -27,7 +27,7 @@ class Entry implements EntryInterface
/**
* Set all lines at once in an array replacing the current lines
*
* @param array $lines
* @param LineInterface[] $lines
* @return $this
*/
public function setLines(array $lines = [])
Expand Down Expand Up @@ -112,7 +112,7 @@ public function getTime()
*
* @return Line
*/
public function current()
public function current(): Line
{
return $this->lines[$this->iterator];
}
Expand All @@ -122,7 +122,7 @@ public function current()
*
* @return void
*/
public function next()
public function next(): void
{
$this->iterator++;
}
Expand All @@ -132,7 +132,7 @@ public function next()
*
* @return int
*/
public function key()
public function key(): int
{
return $this->iterator;
}
Expand All @@ -142,7 +142,7 @@ public function key()
*
* @return boolean
*/
public function valid()
public function valid(): bool
{
return array_key_exists($this->iterator, $this->lines);
}
Expand All @@ -152,7 +152,7 @@ public function valid()
*
* @return void
*/
public function rewind()
public function rewind(): void
{
$this->iterator = 0;
}
Expand All @@ -162,7 +162,7 @@ public function rewind()
*
* @return int
*/
public function count()
public function count(): int
{
return count($this->lines);
}
Expand All @@ -173,7 +173,7 @@ public function count()
* @param mixed $offset
* @return bool
*/
public function offsetExists($offset)
public function offsetExists($offset): bool
{
return isset($this->result[$offset]);
}
Expand All @@ -182,9 +182,9 @@ public function offsetExists($offset)
* Offset to retrieve
*
* @param mixed $offset
* @return Line
* @return LineInterface
*/
public function offsetGet($offset)
public function offsetGet($offset): LineInterface
{
return $this->lines[$offset];
}
Expand All @@ -193,9 +193,9 @@ public function offsetGet($offset)
* Offset to set
*
* @param $offset
* @param Line $value
* @param LineInterface $value
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
$this->lines[$offset] = $value;
}
Expand All @@ -205,15 +205,15 @@ public function offsetSet($offset, $value)
*
* @param $offset
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
unset($this->lines[$offset]);
}

/**
* @return string
*/
public function __toString()
public function __toString(): string
{
return implode("\n", $this->getLines());
}
Expand Down
8 changes: 4 additions & 4 deletions src/Log/EntryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ public function getLines(): array;
/**
* @return string
*/
public function __toString();
public function __toString(): string;

/**
* Return the current element
*
* @return LineInterface
*/
public function current();
public function current(): LineInterface;

/**
* Offset to set
*
* @param $offset
* @param LineInterface $value
*/
public function offsetSet($offset, $value);
public function offsetSet($offset, $value): void;

/**
* Offset to retrieve
*
* @param mixed $offset
* @return LineInterface
*/
public function offsetGet($offset);
public function offsetGet($offset): LineInterface;
}
Loading

0 comments on commit 2fb7421

Please sign in to comment.