Skip to content

Commit

Permalink
styleci updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Tucker authored and Eric Tucker committed May 7, 2024
1 parent 032ccb9 commit 0e4ccc2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/ModelFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ abstract class ModelFilter
protected $blacklist = [];

/**
* Filter out empty input so filter methods won't be called with empty values (strings, arrays, null)
* Filter out empty input so filter methods won't be called with empty values (strings, arrays, null).
*
* @var array
*/
Expand Down Expand Up @@ -289,7 +289,7 @@ public function getRelationConstraints($relation)
*/
public function callRelatedLocalSetup($related, $query)
{
if (method_exists($this, $method = Str::camel($related) . 'Setup')) {
if (method_exists($this, $method = Str::camel($related).'Setup')) {
$this->{$method}($query);
}
}
Expand Down Expand Up @@ -380,7 +380,7 @@ protected function getNestedRelatedModel($relationString)
do {
$relation = array_shift($parts);
$related = $related->{$relation}()->getRelated();
} while (!empty($parts));
} while (! empty($parts));

return $related;
}
Expand Down Expand Up @@ -643,9 +643,9 @@ public function methodIsBlacklisted($method)
*/
public function methodIsCallable($method)
{
return !$this->methodIsBlacklisted($method) &&
return ! $this->methodIsBlacklisted($method) &&
method_exists($this, $method) &&
!method_exists(ModelFilter::class, $method);
! method_exists(ModelFilter::class, $method);
}

/**
Expand All @@ -658,7 +658,7 @@ public function methodIsCallable($method)
*/
protected function includeFilterInput($key, $value)
{
return $value !== '' && $value !== null && !(is_array($value) && empty($value));
return $value !== '' && $value !== null && ! (is_array($value) && empty($value));
}

/**
Expand All @@ -670,8 +670,8 @@ private function registerMacros()
if (
method_exists(Relation::class, 'hasMacro') &&
method_exists(Relation::class, 'macro') &&
!Relation::hasMacro('paginateFilter') &&
!Relation::hasMacro('simplePaginateFilter')
! Relation::hasMacro('paginateFilter') &&
! Relation::hasMacro('simplePaginateFilter')
) {
Relation::macro('paginateFilter', function () {
$paginator = call_user_func_array([$this, 'paginate'], func_get_args());
Expand Down
7 changes: 3 additions & 4 deletions tests/ModelFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function setUp(): void
{
$this->builder = m::mock(EloquentBuilder::class);
$this->filter = new TestModelFilter($this->builder);
$this->config = require __DIR__ . '/config.php';
$this->config = require __DIR__.'/config.php';
$this->testInput = $this->config['test_input'];
}

Expand Down Expand Up @@ -293,7 +293,7 @@ public function testAllowedEmptyFilter()
$emptyInput = [
'empty_array' => [],
'null_value' => null,
'empty_string' => ''
'empty_string' => '',
];

$filter = new class($this->builder, $emptyInput) extends ModelFilter
Expand All @@ -303,8 +303,7 @@ public function testAllowedEmptyFilter()

$this->assertEquals($filter->input(), $emptyInput);

$filter = new class($this->builder, $emptyInput) extends ModelFilter
{
$filter = new class($this->builder, $emptyInput) extends ModelFilter {
};

$this->assertEquals($filter->input(), []);
Expand Down

0 comments on commit 0e4ccc2

Please sign in to comment.