Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Nov 8, 2021
1 parent 7cae8e4 commit a6b13ac
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/.gitignore export-ignore
/.php_cs export-ignore
/.travis.yml export-ignore
/phpstan-baseline.neon export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml export-ignore
/LICENSE export-ignore
Expand Down
7 changes: 7 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
ignoreErrors:
-
message: "#^Cannot use array destructuring on Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\), mixed\\>&iterable\\<Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\), mixed\\>\\>\\.$#"
count: 1
path: src/Searchable.php

1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
includes:
- ./vendor/nunomaduro/larastan/extension.neon
- ./phpstan-baseline.neon

parameters:

Expand Down
2 changes: 1 addition & 1 deletion src/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getOriginalValue()
*/
public function getValue(): string
{
if (is_string($this->name)) {
if (\is_string($this->name)) {
return $this->name;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ protected function validateJsonPath(): bool
*/
public function isRelationSelector(): bool
{
return strpos($this->name ?? '', '.') !== false;
return strpos($this->name, '.') !== false;
}

/**
* Is JSON path selector.
*/
public function isJsonPathSelector(): bool
{
return strpos($this->name ?? '', '->') !== false;
return strpos($this->name, '->') !== false;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Keyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static function searchable(
}

return [
str_replace($wildcard ?? '*', $replacement ?? '%', $text),
str_replace($wildcard ?? '*', $replacement, $text),
];
}

Expand Down
4 changes: 4 additions & 0 deletions src/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public function apply($query)

$likeOperator = like_operator(connection_type($query));

/**
* @var \Illuminate\Support\Collection $filters
* @var \Illuminate\Support\Collection $fields
*/
[$filters, $fields] = Collection::make($this->fields)->partition(static function ($field) {
return $field instanceof Contracts\Filter\Filter;
});
Expand Down

0 comments on commit a6b13ac

Please sign in to comment.