mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Fixes for PHP 7
This commit is contained in:
parent
761b3d5333
commit
90b66241b3
2 changed files with 12 additions and 8 deletions
|
@ -9,15 +9,18 @@ namespace JKingWeb\Arsse\Context;
|
||||||
class UnionContext extends RootContext implements \ArrayAccess, \Countable, \IteratorAggregate {
|
class UnionContext extends RootContext implements \ArrayAccess, \Countable, \IteratorAggregate {
|
||||||
protected $contexts = [];
|
protected $contexts = [];
|
||||||
|
|
||||||
public function offsetExists(mixed $offset): bool {
|
#[\ReturnTypeWillChange]
|
||||||
|
public function offsetExists($offset) {
|
||||||
return isset($this->contexts[$offset]);
|
return isset($this->contexts[$offset]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet(mixed $offset): mixed {
|
#[\ReturnTypeWillChange]
|
||||||
|
public function offsetGet($offset) {
|
||||||
return $this->contexts[$offset] ?? null;
|
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"));
|
assert($value instanceof RootContext, new \Exception("Union contexts may only contain other non-exclusion contexts"));
|
||||||
if (isset($offset)) {
|
if (isset($offset)) {
|
||||||
$this->contexts[$offset] = $value;
|
$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]);
|
unset($this->contexts[$offset]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class QueryFilter {
|
||||||
protected $vWhereNot = []; // WHERE NOT clause binding values
|
protected $vWhereNot = []; // WHERE NOT clause binding values
|
||||||
protected $filterRestrictive = true; // Whether to glue WHERE conditions with OR (false) or AND (true)
|
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;
|
$this->qWhere[] = $where;
|
||||||
if (!is_null($types)) {
|
if (!is_null($types)) {
|
||||||
$this->tWhere[] = $types ?? [];
|
$this->tWhere[] = $types ?? [];
|
||||||
|
@ -24,7 +24,7 @@ class QueryFilter {
|
||||||
return $this;
|
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;
|
$this->qWhereNot[] = $where;
|
||||||
if (!is_null($types)) {
|
if (!is_null($types)) {
|
||||||
$this->tWhereNot[] = $types;
|
$this->tWhereNot[] = $types;
|
||||||
|
@ -33,14 +33,14 @@ class QueryFilter {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setWhereGroup(self $filter): static {
|
public function setWhereGroup(self $filter): self {
|
||||||
$this->qWhere[] = "(".$filter->buildWhereBody().")";
|
$this->qWhere[] = "(".$filter->buildWhereBody().")";
|
||||||
$this->tWhere[] = $filter->getWhereTypes();
|
$this->tWhere[] = $filter->getWhereTypes();
|
||||||
$this->vWhere[] = $filter->getWhereValues();
|
$this->vWhere[] = $filter->getWhereValues();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setWhereRestrictive(bool $restrictive): static {
|
public function setWhereRestrictive(bool $restrictive): self {
|
||||||
$this->filterRestrictive = $restrictive;
|
$this->filterRestrictive = $restrictive;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue