Skip to content

Commit

Permalink
fix return types in wheregroup for php8.1 compatibility, increase min…
Browse files Browse the repository at this point in the history
…imum php version to 8.0
  • Loading branch information
matthi4s committed Mar 24, 2022
1 parent 81d3fd7 commit 8a45ca0
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 56 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"minimum-stability": "stable",
"require": {
"php": ">=7.4",
"php": ">=8.0",
"ext-json": "*"
},
"require-dev": {
Expand Down
119 changes: 73 additions & 46 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions src/Query/WhereGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,10 @@ public function __construct(array $conditions = [], int $conjunction = self:: AN
/**
* Add an element to the group
*
* @param WhereGroup|WhereCondition $conditionOrGroup
* @param WhereCondition|WhereGroup $conditionOrGroup
*/
public function add($conditionOrGroup)
public function add(WhereCondition|WhereGroup $conditionOrGroup)
{
if (!$conditionOrGroup instanceof WhereCondition && !$conditionOrGroup instanceof WhereGroup) {
throw new \InvalidArgumentException('Argument $conditionOrGroup has to be instance of WhereCondition or WhereGroup.');
}

$this->group[] = $conditionOrGroup;
}

Expand All @@ -75,7 +71,7 @@ public function getAll(): array
*
* @return WhereGroup|WhereCondition
*/
public function current()
public function current(): WhereGroup|WhereCondition
{
return $this->group[$this->iterator];
}
Expand All @@ -85,7 +81,7 @@ public function current()
*
* @return void
*/
public function next()
public function next(): void
{
$this->iterator++;
}
Expand Down Expand Up @@ -115,7 +111,7 @@ public function valid(): bool
*
* @return void
*/
public function rewind()
public function rewind(): void
{
$this->iterator = 0;
}
Expand Down

0 comments on commit 8a45ca0

Please sign in to comment.