Skip to content

Commit

Permalink
Merge pull request #15 from laravie/update-master
Browse files Browse the repository at this point in the history
Merge to `master`
  • Loading branch information
crynobone committed Nov 8, 2021
2 parents a1f2dcd + eceb67b commit eaf299a
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 10 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
50 changes: 50 additions & 0 deletions .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: experimental

on:
push:
pull_request:

jobs:
tests:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
os:
- "ubuntu-latest"
php:
- "8.1"
dependencies:
- "locked"
- "highest"
- "lowest"
laravel:
- "8.x"
experimental:
- false

name: Laravel ${{ matrix.laravel }} on PHP${{ matrix.php }}-${{ matrix.os }} (${{ matrix.dependencies }})

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlite3, pdo_sqlite, bcmath, fileinfo
coverage: none

- name: Install Laravel Framework ${{ matrix.laravel }}
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
- name: Install dependencies
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--prefer-dist --no-cache --ignore-platform-reqs"

- name: Execute tests
run: vendor/bin/phpunit
8 changes: 8 additions & 0 deletions CHANGELOG-3.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

This changelog references the relevant changes (bug and security fixes) done to `laravie/query-filter`.

## 3.2.0

Released: 2021-10-27

### Added

* Added support for PHP 8.1.

## 3.1.0

Released: 2021-06-18
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
},
"require": {
"php": "^7.3 || ^8.0",
"illuminate/database": "^8.25 || ^9.0",
"illuminate/support": "^8.25 || ^9.0"
"illuminate/database": "^8.67 || ^9.0",
"illuminate/support": "^8.67 || ^9.0"
},
"require-dev": {
"nunomaduro/larastan": "^0.7.10",
"orchestra/canvas": "^6.1 || ^7.0",
"orchestra/testbench": "^6.16 || ^7.0"
"nunomaduro/larastan": "^1.0.1",
"orchestra/canvas": "^6.7 || ^7.0",
"orchestra/testbench": "^6.22 || ^7.0"
},
"config": {
"sort-packages": true
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

3 changes: 2 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
includes:
- ./vendor/nunomaduro/larastan/extension.neon
- ./phpstan-baseline.neon

parameters:

paths:
- 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
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
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 eaf299a

Please sign in to comment.