Browse Source

Fixes for PHP 7

reader
J. King 2 years ago
parent
commit
90b66241b3
  1. 12
      lib/Context/UnionContext.php
  2. 8
      lib/Misc/QueryFilter.php

12
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]);
}

8
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;
}

Loading…
Cancel
Save