From 90b66241b3a0e9f7f79e180306f28956c0da6837 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Sat, 30 Apr 2022 13:50:35 -0400 Subject: [PATCH] Fixes for PHP 7 --- lib/Context/UnionContext.php | 12 ++++++++---- lib/Misc/QueryFilter.php | 8 ++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/Context/UnionContext.php b/lib/Context/UnionContext.php index db5a98f3..a8c17499 100644 --- a/lib/Context/UnionContext.php +++ b/lib/Context/UnionContext.php @@ -9,15 +9,18 @@ namespace JKingWeb\Arsse\Context; class UnionContext extends RootContext implements \ArrayAccess, \Countable, \IteratorAggregate { protected $contexts = []; - public function offsetExists(mixed $offset): bool { + #[\ReturnTypeWillChange] + public function offsetExists($offset) { return isset($this->contexts[$offset]); } - public function offsetGet(mixed $offset): mixed { + #[\ReturnTypeWillChange] + public function offsetGet($offset) { return $this->contexts[$offset] ?? null; } - public function offsetSet(mixed $offset, mixed $value): void { + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) { assert($value instanceof RootContext, new \Exception("Union contexts may only contain other non-exclusion contexts")); if (isset($offset)) { $this->contexts[$offset] = $value; @@ -26,7 +29,8 @@ class UnionContext extends RootContext implements \ArrayAccess, \Countable, \Ite } } - public function offsetUnset(mixed $offset): void { + #[\ReturnTypeWillChange] + public function offsetUnset($offset) { unset($this->contexts[$offset]); } diff --git a/lib/Misc/QueryFilter.php b/lib/Misc/QueryFilter.php index f099487d..a15a63a5 100644 --- a/lib/Misc/QueryFilter.php +++ b/lib/Misc/QueryFilter.php @@ -15,7 +15,7 @@ class QueryFilter { protected $vWhereNot = []; // WHERE NOT clause binding values protected $filterRestrictive = true; // Whether to glue WHERE conditions with OR (false) or AND (true) - public function setWhere(string $where, $types = null, $values = null): static { + public function setWhere(string $where, $types = null, $values = null): self { $this->qWhere[] = $where; if (!is_null($types)) { $this->tWhere[] = $types ?? []; @@ -24,7 +24,7 @@ class QueryFilter { return $this; } - public function setWhereNot(string $where, $types = null, $values = null): static { + public function setWhereNot(string $where, $types = null, $values = null): self { $this->qWhereNot[] = $where; if (!is_null($types)) { $this->tWhereNot[] = $types; @@ -33,14 +33,14 @@ class QueryFilter { return $this; } - public function setWhereGroup(self $filter): static { + public function setWhereGroup(self $filter): self { $this->qWhere[] = "(".$filter->buildWhereBody().")"; $this->tWhere[] = $filter->getWhereTypes(); $this->vWhere[] = $filter->getWhereValues(); return $this; } - public function setWhereRestrictive(bool $restrictive): static { + public function setWhereRestrictive(bool $restrictive): self { $this->filterRestrictive = $restrictive; return $this; }