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 Aug 1, 2021
1 parent dd7a1c0 commit f8707ab
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
- src

# The level 8 is the highest level
level: 5
level: 8

ignoreErrors:
- '#Unsafe usage of new static#'
Expand Down
6 changes: 5 additions & 1 deletion src/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ public function getOriginalValue()
*/
public function getValue(): string
{
return $this->isExpression() ? $this->name->getValue() : $this->name;
if (is_string($this->name)) {
return $this->name;
}

return $this->name->getValue();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Concerns/SearchingWildcard.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait SearchingWildcard
/**
* Wildcard search character replacement.
*
* @var string
* @var string|null
*/
public $wildcardReplacement = '%';

Expand Down
1 change: 1 addition & 0 deletions src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public function isJsonPathSelector(): bool
*/
protected function wrapJsonPath(string $value, string $delimiter = '->'): string
{
/** @var string $value */
$value = preg_replace("/([\\\\]+)?\\'/", "\\'", $value);

return str_replace($delimiter, '.', $value);
Expand Down
3 changes: 2 additions & 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 All @@ -125,6 +125,7 @@ public static function searchable(
*/
public static function sanitize(string $keyword): string
{
/** @var string $words */
$words = preg_replace('/[^\w\*\s]/iu', '', $keyword);

if (empty(trim($words))) {
Expand Down
2 changes: 1 addition & 1 deletion src/Taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Taxonomy
/**
* Taxonomy rules.
*
* @var array
* @var array<string,callable>
*/
protected $rules = [];

Expand Down

0 comments on commit f8707ab

Please sign in to comment.