1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 05:02:40 +00:00

Fixes for PHP 7

This commit is contained in:
J. King 2022-04-30 13:50:35 -04:00
parent 761b3d5333
commit 90b66241b3
2 changed files with 12 additions and 8 deletions

View file

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

View file

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