Skip to content

Commit

Permalink
apply code changes by rector
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Nov 17, 2023
1 parent f30ea7e commit a99401f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/AllowedSort.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(string $name, Sort $sortClass, ?string $internalName

public static function parseSortDirection(string $name): string
{
return strpos($name, '-') === 0 ? SortDirection::DESCENDING : SortDirection::ASCENDING;
return str_starts_with($name, '-') ? SortDirection::DESCENDING : SortDirection::ASCENDING;
}

public function sort(QueryBuilder $query, ?bool $descending = null): void
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/InvalidSubject.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static function make($subject)
sprintf(
'Subject %s is invalid.',
is_object($subject)
? sprintf('class `%s`', get_class($subject))
? sprintf('class `%s`', $subject::class)
: sprintf('type `%s`', gettype($subject))
)
);
Expand Down
4 changes: 1 addition & 3 deletions src/Filters/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ interface Filter
{
/**
* @param \Illuminate\Database\Eloquent\Builder<TModelClass> $query
* @param mixed $value
* @param string $property
*
* @return mixed
*/
public function __invoke(Builder $query, $value, string $property);
public function __invoke(Builder $query, mixed $value, string $property);
}
2 changes: 1 addition & 1 deletion src/Filters/FiltersScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function resolveParameters(Builder $query, $values, string $scope): ar
$parameters = (new ReflectionObject($query->getModel()))
->getMethod('scope' . ucfirst($scope))
->getParameters();
} catch (ReflectionException $e) {
} catch (ReflectionException) {
return $values;
}

Expand Down
9 changes: 4 additions & 5 deletions src/Includes/IncludeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
interface IncludeInterface
{
/**
* @param \Illuminate\Database\Eloquent\Builder<TModelClass> $query
* @param string $include
*
* @return mixed
*/
* @param \Illuminate\Database\Eloquent\Builder<TModelClass> $query
*
* @return mixed
*/
public function __invoke(Builder $query, string $include);
}
5 changes: 1 addition & 4 deletions src/Includes/IncludedCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@

class IncludedCallback implements IncludeInterface
{
protected Closure $callback;

public function __construct(Closure $callback)
public function __construct(protected Closure $callback)
{
$this->callback = $callback;
}

public function __invoke(Builder $query, string $relation)
Expand Down

0 comments on commit a99401f

Please sign in to comment.