Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AllowedFilter should return static rather than self #964

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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