From 0eb7bcc6e875f50221e32be5929593b6becb6c10 Mon Sep 17 00:00:00 2001 From: Walter K Date: Wed, 14 Aug 2024 13:29:29 +0300 Subject: [PATCH] AllowedFilter should return static rather than self. --- src/AllowedFilter.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/AllowedFilter.php b/src/AllowedFilter.php index a9ba5bb0..8d87d679 100644 --- a/src/AllowedFilter.php +++ b/src/AllowedFilter.php @@ -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); @@ -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) @@ -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; @@ -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);