Skip to content

Commit bff298a

Browse files
committed
feat: add support for Laravel 12
1 parent 07f8ae4 commit bff298a

12 files changed

+157
-59
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ root = true
22

33
[*]
44
charset = utf-8
5+
end_of_line = lf
56
indent_size = 4
67
indent_style = space
7-
end_of_line = lf
88
insert_final_newline = true
99
trim_trailing_whitespace = true
1010

.gitattributes

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
# Path-based git attributes
2-
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
2+
# https://git-scm.com/docs/gitattributes
3+
* text=auto
34

45
# Ignore all test and documentation with "export-ignore".
5-
/.github export-ignore
6-
/.gitattributes export-ignore
7-
/.gitignore export-ignore
8-
/phpunit.xml.dist export-ignore
9-
/art export-ignore
10-
/docs export-ignore
11-
/tests export-ignore
12-
/.editorconfig export-ignore
13-
/.php_cs.dist.php export-ignore
14-
/psalm.xml export-ignore
15-
/psalm.xml.dist export-ignore
16-
/testbench.yaml export-ignore
17-
/UPGRADING.md export-ignore
18-
/phpstan.neon.dist export-ignore
6+
/.github export-ignore
7+
/.gitattributes export-ignore
8+
/.gitignore export-ignore
9+
/phpunit.xml.dist export-ignore
10+
/art export-ignore
11+
/docs export-ignore
12+
/tests export-ignore
13+
/.editorconfig export-ignore
14+
/.php_cs.dist.php export-ignore
15+
/psalm.xml export-ignore
16+
/psalm.xml.dist export-ignore
17+
/testbench.yaml export-ignore
18+
/UPGRADING.md export-ignore
19+
/phpstan.neon.dist export-ignore
1920
/phpstan-baseline.neon export-ignore
20-
/docker export-ignore
21-
/docker-compose.yml export-ignore
21+
/docker export-ignore
22+
/docker-compose.yml export-ignore

.github/workflows/dependabot-auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
- name: Dependabot metadata
1515
id: metadata
16-
uses: dependabot/fetch-metadata@v1
16+
uses: dependabot/fetch-metadata@v2
1717
with:
1818
github-token: "${{ secrets.GITHUB_TOKEN }}"
1919

.github/workflows/static.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,32 @@ jobs:
1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: '8.2'
19+
php-version: '8.3'
2020
coverage: none
2121

2222
- name: Install composer dependencies
23-
uses: ramsey/composer-install@v2
23+
uses: ramsey/composer-install@v3
2424

2525
- name: Run PHPStan
2626
run: composer test:types
27+
28+
ecs:
29+
name: ECS
30+
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: '8.3'
41+
coverage: none
42+
43+
- name: Install Dependencies
44+
run: composer update --prefer-dist --no-interaction --no-progress --ansi
45+
46+
- name: Run ECS
47+
run: composer test:style

.github/workflows/tests.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,16 @@ on:
99
jobs:
1010
test:
1111
runs-on: ${{ matrix.os }}
12-
env:
13-
PREVENT_OUTPUT: true
1412
strategy:
1513
fail-fast: true
1614
matrix:
1715
os: [ubuntu-latest]
18-
php: [8.2, 8.3]
19-
laravel: [10.*, 11.*]
20-
stability: [prefer-stable]
16+
php: [8.4, 8.3]
17+
laravel: [12.*, 11.*]
18+
stability: [prefer-lowest, prefer-stable]
2119
include:
22-
- laravel: 10.*
23-
testbench: 8.*
20+
- laravel: 12.*
21+
testbench: 10.*
2422
- laravel: 11.*
2523
testbench: 9.*
2624

@@ -34,7 +32,6 @@ jobs:
3432
uses: shivammathur/setup-php@v2
3533
with:
3634
php-version: ${{ matrix.php }}
37-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
3835
coverage: none
3936

4037
- name: Setup problem matchers
@@ -44,8 +41,8 @@ jobs:
4441
4542
- name: Install dependencies
4643
run: |
47-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
48-
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
44+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --ansi
45+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ansi
4946
5047
- name: Execute tests
5148
run: composer test:unit

.gitignore

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
.idea
1+
/.idea
2+
/build
3+
/vendor
4+
/.php_cs.cache
5+
/composer.lock
6+
/phpunit.xml
7+
/phpstan.neon
28
.php_cs
39
.php_cs.cache
410
.phpunit.cache
5-
build
6-
composer.lock
11+
.php-cs-fixer.cache
712
coverage
813
docs
9-
phpunit.xml
10-
phpstan.neon
11-
testbench.yaml
12-
vendor
1314
node_modules
14-
.php-cs-fixer.cache
15+
testbench.yaml

composer.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^8.2",
20-
"illuminate/contracts": "^10.0 || ^11.0",
21-
"illuminate/database": "^10.0 || ^11.0",
22-
"spatie/laravel-package-tools": "^1.16",
19+
"php": "^8.3",
20+
"illuminate/contracts": "^11.0 || ^12.0",
21+
"illuminate/database": "^11.0 || ^12.0",
22+
"spatie/laravel-package-tools": "^1.19",
2323
"tucker-eric/eloquentfilter": "^3.3"
2424
},
2525
"require-dev": {
2626
"ext-pdo": "*",
27-
"nunomaduro/collision": "^7.10 || ^8.1",
28-
"larastan/larastan": "^2.6",
29-
"orchestra/testbench": "^8.21 || ^9.0",
30-
"pestphp/pest": "^2.33",
31-
"pestphp/pest-plugin-laravel": "^2.2",
32-
"worksome/coding-style": "^2.8"
27+
"larastan/larastan": "^3.1",
28+
"nunomaduro/collision": "^7.10 || ^8.1.1",
29+
"orchestra/testbench": "^9.12 || ^10.1",
30+
"pestphp/pest": "^3.7",
31+
"pestphp/pest-plugin-laravel": "^3.1",
32+
"worksome/coding-style": "^3.2"
3333
},
3434
"autoload": {
3535
"psr-4": {

docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3.8"
2-
31
services:
42
php:
53
build: ./docker

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.2-cli-alpine
1+
FROM php:8.3-cli-alpine
22

33
RUN apk add --no-cache $PHPIZE_DEPS linux-headers
44
RUN pecl install xdebug

phpstan-baseline.neon

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,85 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Call to an undefined method Worksome\\\\Filters\\\\ModelFilter\\:\\:withTrashed\\(\\)\\.$#"
4+
message: '#^PHPDoc tag @method for method Worksome\\Filters\\Filter\:\:apply\(\) return type contains generic class Worksome\\Filters\\FilterQuery but does not specify its types\: TModel, TFilter$#'
5+
identifier: missingType.generics
6+
count: 1
7+
path: src/Filter.php
8+
9+
-
10+
message: '#^PHPDoc tag @method for method Worksome\\Filters\\Filter\:\:get\(\) return type contains generic class Illuminate\\Support\\Collection but does not specify its types\: TKey, TValue$#'
11+
identifier: missingType.generics
12+
count: 1
13+
path: src/Filter.php
14+
15+
-
16+
message: '#^PHPDoc tag @method for method Worksome\\Filters\\Filter\:\:getQuery\(\) return type contains generic class Illuminate\\Database\\Eloquent\\Builder but does not specify its types\: TModel$#'
17+
identifier: missingType.generics
18+
count: 1
19+
path: src/Filter.php
20+
21+
-
22+
message: '#^PHPDoc tag @method for method Worksome\\Filters\\Filter\:\:input\(\) return type contains generic class Worksome\\Filters\\FilterQuery but does not specify its types\: TModel, TFilter$#'
23+
identifier: missingType.generics
24+
count: 1
25+
path: src/Filter.php
26+
27+
-
28+
message: '#^PHPDoc tag @method for method Worksome\\Filters\\Filter\:\:model\(\) return type contains generic class Worksome\\Filters\\FilterQuery but does not specify its types\: TModel, TFilter$#'
29+
identifier: missingType.generics
30+
count: 1
31+
path: src/Filter.php
32+
33+
-
34+
message: '#^PHPDoc tag @method for method Worksome\\Filters\\Filter\:\:paginateFilter\(\) return type contains generic interface Illuminate\\Contracts\\Pagination\\LengthAwarePaginator but does not specify its types\: TItem$#'
35+
identifier: missingType.generics
36+
count: 1
37+
path: src/Filter.php
38+
39+
-
40+
message: '#^PHPDoc tag @method for method Worksome\\Filters\\Filter\:\:query\(\) parameter \#1 \$query contains generic class Illuminate\\Database\\Eloquent\\Builder but does not specify its types\: TModel$#'
41+
identifier: missingType.generics
42+
count: 1
43+
path: src/Filter.php
44+
45+
-
46+
message: '#^PHPDoc tag @method for method Worksome\\Filters\\Filter\:\:query\(\) return type contains generic class Worksome\\Filters\\FilterQuery but does not specify its types\: TModel, TFilter$#'
47+
identifier: missingType.generics
48+
count: 1
49+
path: src/Filter.php
50+
51+
-
52+
message: '#^PHPDoc tag @method for method Worksome\\Filters\\Filter\:\:simplePaginateFilter\(\) return type contains generic interface Illuminate\\Contracts\\Pagination\\Paginator but does not specify its types\: TItem$#'
53+
identifier: missingType.generics
54+
count: 1
55+
path: src/Filter.php
56+
57+
-
58+
message: '#^Method Worksome\\Filters\\FilterQuery\:\:getQuery\(\) should return Illuminate\\Database\\Eloquent\\Builder\<TModel of Illuminate\\Database\\Eloquent\\Model\> but returns Illuminate\\Database\\Eloquent\\Builder\<Illuminate\\Database\\Eloquent\\Model\>\.$#'
59+
identifier: return.type
60+
count: 1
61+
path: src/FilterQuery.php
62+
63+
-
64+
message: '#^Parameter \#2 \$columns of method Illuminate\\Database\\Eloquent\\Builder\<TModel of Illuminate\\Database\\Eloquent\\Model\>\:\:paginate\(\) expects array\<int, model property of TModel of Illuminate\\Database\\Eloquent\\Model\>, array\<string\> given\.$#'
65+
identifier: argument.type
66+
count: 1
67+
path: src/FilterQuery.php
68+
69+
-
70+
message: '#^Property Worksome\\Filters\\FilterQuery\:\:\$query \(Illuminate\\Database\\Eloquent\\Builder\<TModel of Illuminate\\Database\\Eloquent\\Model\>\|null\) is never assigned Illuminate\\Database\\Eloquent\\Builder\<TModel of Illuminate\\Database\\Eloquent\\Model\> so it can be removed from the property type\.$#'
71+
identifier: property.unusedType
72+
count: 1
73+
path: src/FilterQuery.php
74+
75+
-
76+
message: '#^Property Worksome\\Filters\\FilterQuery\<TModel of Illuminate\\Database\\Eloquent\\Model,TFilter of Worksome\\Filters\\ModelFilter\>\:\:\$query \(Illuminate\\Database\\Eloquent\\Builder\<TModel of Illuminate\\Database\\Eloquent\\Model\>\|null\) does not accept Illuminate\\Database\\Eloquent\\Builder\<Illuminate\\Database\\Eloquent\\Model\>\.$#'
77+
identifier: assign.propertyType
78+
count: 1
79+
path: src/FilterQuery.php
80+
81+
-
82+
message: '#^Call to an undefined method Worksome\\Filters\\ModelFilter\:\:withTrashed\(\)\.$#'
83+
identifier: method.notFound
584
count: 1
685
path: src/ModelFilter.php

phpunit.xml.dist

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
cacheDirectory=".phpunit.cache"
88
>
99
<testsuites>
10-
<testsuite name="Worksome Test Suite">
10+
<testsuite name="Test Suite">
1111
<directory>tests</directory>
1212
</testsuite>
1313
</testsuites>
14-
<php>
15-
<server name="DB_CONNECTION" value="sqlite"/>
16-
<server name="DB_DATABASE" value=":memory:"/>
17-
</php>
14+
<source>
15+
<include>
16+
<directory suffix=".php">./src</directory>
17+
</include>
18+
</source>
1819
</phpunit>

tests/Feature/SortableFilterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
->get();
4444

4545
$collection_sorted = $filtered
46-
->sortByDesc(fn(TestModel $model) => $model->non_sortable->timestamp)
46+
->sortByDesc(fn (TestModel $model) => $model->non_sortable->timestamp)
4747
->values();
4848

4949
expect($filtered->pluck('name')->toArray())->not->toEqual($collection_sorted->pluck('name')->toArray());

0 commit comments

Comments
 (0)