Skip to content

Commit

Permalink
Merge pull request #964 from kosarinin/allowed-filter-should-return-s…
Browse files Browse the repository at this point in the history
…tatic

AllowedFilter should return static rather than self
  • Loading branch information
Nielsvanpach authored Sep 23, 2024
2 parents fb28926 + 0eb7bcc commit f3c7828
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/AllowedFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,54 +52,54 @@ public static function setFilterArrayValueDelimiter(string $delimiter = null): v
}
}

public static function exact(string $name, ?string $internalName = null, bool $addRelationConstraint = true, string $arrayValueDelimiter = null): self
public static function exact(string $name, ?string $internalName = null, bool $addRelationConstraint = true, string $arrayValueDelimiter = null): static
{
static::setFilterArrayValueDelimiter($arrayValueDelimiter);

return new static($name, new FiltersExact($addRelationConstraint), $internalName);
}

public static function partial(string $name, $internalName = null, bool $addRelationConstraint = true, string $arrayValueDelimiter = null): self
public static function partial(string $name, $internalName = null, bool $addRelationConstraint = true, string $arrayValueDelimiter = null): static
{
static::setFilterArrayValueDelimiter($arrayValueDelimiter);

return new static($name, new FiltersPartial($addRelationConstraint), $internalName);
}

public static function beginsWithStrict(string $name, $internalName = null, bool $addRelationConstraint = true, string $arrayValueDelimiter = null): self
public static function beginsWithStrict(string $name, $internalName = null, bool $addRelationConstraint = true, string $arrayValueDelimiter = null): static
{
static::setFilterArrayValueDelimiter($arrayValueDelimiter);

return new static($name, new FiltersBeginsWithStrict($addRelationConstraint), $internalName);
}

public static function endsWithStrict(string $name, $internalName = null, bool $addRelationConstraint = true, string $arrayValueDelimiter = null): self
public static function endsWithStrict(string $name, $internalName = null, bool $addRelationConstraint = true, string $arrayValueDelimiter = null): static
{
static::setFilterArrayValueDelimiter($arrayValueDelimiter);

return new static($name, new FiltersEndsWithStrict($addRelationConstraint), $internalName);
}

public static function scope(string $name, $internalName = null, string $arrayValueDelimiter = null): self
public static function scope(string $name, $internalName = null, string $arrayValueDelimiter = null): static
{
static::setFilterArrayValueDelimiter($arrayValueDelimiter);

return new static($name, new FiltersScope(), $internalName);
}

public static function callback(string $name, $callback, $internalName = null, string $arrayValueDelimiter = null): self
public static function callback(string $name, $callback, $internalName = null, string $arrayValueDelimiter = null): static
{
static::setFilterArrayValueDelimiter($arrayValueDelimiter);

return new static($name, new FiltersCallback($callback), $internalName);
}

public static function trashed(string $name = 'trashed', $internalName = null): self
public static function trashed(string $name = 'trashed', $internalName = null): static
{
return new static($name, new FiltersTrashed(), $internalName);
}

public static function custom(string $name, Filter $filterClass, $internalName = null, string $arrayValueDelimiter = null): self
public static function custom(string $name, Filter $filterClass, $internalName = null, string $arrayValueDelimiter = null): static
{
static::setFilterArrayValueDelimiter($arrayValueDelimiter);

Expand All @@ -121,7 +121,7 @@ public function isForFilter(string $filterName): bool
return $this->name === $filterName;
}

public function ignore(...$values): self
public function ignore(...$values): static
{
$this->ignored = $this->ignored
->merge($values)
Expand All @@ -140,7 +140,7 @@ public function getInternalName(): string
return $this->internalName;
}

public function default($value): self
public function default($value): static
{
$this->hasDefault = true;
$this->default = $value;
Expand All @@ -162,14 +162,14 @@ public function hasDefault(): bool
return $this->hasDefault;
}

public function nullable(bool $nullable = true): self
public function nullable(bool $nullable = true): static
{
$this->nullable = $nullable;

return $this;
}

public function unsetDefault(): self
public function unsetDefault(): static
{
$this->hasDefault = false;
unset($this->default);
Expand Down

0 comments on commit f3c7828

Please sign in to comment.