Skip to content

Commit 2f22e4b

Browse files
committed
wip
1 parent f2b1b5b commit 2f22e4b

27 files changed

+636
-545
lines changed

.github/workflows/phpstan.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: PHPStan
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
jobs:
10+
phpstan:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: '8.2'
20+
extensions: mbstring, xml, json
21+
coverage: none
22+
23+
- name: Install dependencies
24+
run: composer install --prefer-dist --no-progress --no-suggest
25+
26+
- name: Run PHPStan
27+
run: ./vendor/bin/phpstan analyse

.github/workflows/pint.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Laravel Pint
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
jobs:
10+
pint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: '8.2'
20+
extensions: mbstring, xml, json
21+
coverage: none
22+
23+
- name: Install dependencies
24+
run: composer install --prefer-dist --no-progress --no-suggest
25+
26+
- name: Run Laravel Pint
27+
run: ./vendor/bin/pint --test

.github/workflows/rector.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Rector
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
rector:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: 8.3
20+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
21+
coverage: none
22+
23+
- name: Install dependencies
24+
run: composer install --prefer-dist --no-progress
25+
26+
- name: Run Rector
27+
run: vendor/bin/rector --dry-run --no-progress-bar

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
"illuminate/support": "^10.48.28|^11.43|^12.0"
2121
},
2222
"require-dev": {
23+
"driftingly/rector-laravel": "^2.0",
24+
"larastan/larastan": "^3.6",
25+
"laravel/pint": "^1.24",
2326
"mockery/mockery": "^1.4.4",
2427
"orchestra/testbench": "^8.0|^9.0|^10.0",
25-
"phpunit/phpunit": "^10.4|^11.5.3"
28+
"phpunit/phpunit": "^10.4|^11.5.3",
29+
"rector/rector": "^2.0"
2630
},
2731
"autoload": {
2832
"psr-4": {
@@ -50,4 +54,4 @@
5054
]
5155
}
5256
}
53-
}
57+
}

phpstan.neon

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
includes:
2+
- ./vendor/larastan/larastan/extension.neon
3+
4+
parameters:
5+
level: max
6+
paths:
7+
- src
8+
excludePaths:
9+
- tests
10+
editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%'
11+
reportUnmatchedIgnoredErrors: false

pint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"preset": "laravel"
3+
}

rector.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Set\ValueObject\LevelSetList;
7+
use Rector\Set\ValueObject\SetList;
8+
use RectorLaravel\Set\LaravelLevelSetList;
9+
use RectorLaravel\Set\LaravelSetList;
10+
11+
return RectorConfig::configure()
12+
->withPaths([
13+
__DIR__.'/src',
14+
__DIR__.'/tests',
15+
])
16+
->withSets([
17+
LevelSetList::UP_TO_PHP_83,
18+
LaravelLevelSetList::UP_TO_LARAVEL_110,
19+
LaravelSetList::LARAVEL_CODE_QUALITY,
20+
LaravelSetList::LARAVEL_COLLECTION,
21+
SetList::CODE_QUALITY,
22+
SetList::DEAD_CODE,
23+
SetList::NAMING,
24+
SetList::TYPE_DECLARATION,
25+
SetList::EARLY_RETURN,
26+
])
27+
->withSkip([
28+
// Skip test models
29+
__DIR__.'/tests/Blog.php',
30+
__DIR__.'/tests/Comment.php',
31+
__DIR__.'/tests/Page.php',
32+
__DIR__.'/tests/Post.php',
33+
__DIR__.'/tests/Video.php',
34+
__DIR__.'/tests/VideoJson.php',
35+
__DIR__.'/tests/create_tables.php',
36+
]);

src/DatabaseGrammarFactory.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace ProtoneMedia\LaravelCrossEloquentSearch;
46

57
use Illuminate\Database\Connection;
68
use ProtoneMedia\LaravelCrossEloquentSearch\Exceptions\InvalidGrammarException;
79
use ProtoneMedia\LaravelCrossEloquentSearch\Grammars\MySqlSearchGrammar;
8-
use ProtoneMedia\LaravelCrossEloquentSearch\Grammars\SQLiteSearchGrammar;
910
use ProtoneMedia\LaravelCrossEloquentSearch\Grammars\SearchGrammarInterface;
11+
use ProtoneMedia\LaravelCrossEloquentSearch\Grammars\SQLiteSearchGrammar;
1012

1113
/**
1214
* Factory for creating database-specific search grammar instances.
1315
*
14-
* This factory provides database-agnostic access to search functionality by
16+
* This factory provides database-agnostic access to search functionality by
1517
* creating the appropriate grammar implementation based on the database driver.
1618
* Currently supports MySQL/MariaDB and SQLite.
1719
*/
@@ -20,8 +22,6 @@ class DatabaseGrammarFactory
2022
/**
2123
* Create a search grammar instance for the given database connection.
2224
*
23-
* @param \Illuminate\Database\Connection $connection
24-
* @return \ProtoneMedia\LaravelCrossEloquentSearch\Grammars\SearchGrammarInterface
2525
* @throws InvalidGrammarException
2626
*/
2727
public static function make(Connection $connection): SearchGrammarInterface
@@ -38,4 +38,4 @@ public static function make(Connection $connection): SearchGrammarInterface
3838
throw InvalidGrammarException::driverNotSupported($driver);
3939
}
4040
}
41-
}
41+
}

src/Exceptions/InvalidGrammarException.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace ProtoneMedia\LaravelCrossEloquentSearch\Exceptions;
46

@@ -10,4 +12,4 @@ public static function driverNotSupported(string $driver): self
1012
{
1113
return new self("Database driver '{$driver}' is not supported for cross-eloquent search.");
1214
}
13-
}
15+
}

src/Exceptions/OrderByRelevanceException.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace ProtoneMedia\LaravelCrossEloquentSearch\Exceptions;
46

@@ -10,4 +12,4 @@ public static function relationColumnsNotSupported(): self
1012
{
1113
return new self('Cannot order by relevance when searching through relationship columns.');
1214
}
13-
}
15+
}

0 commit comments

Comments
 (0)