Skip to content

Commit e781b78

Browse files
L12 compatibility (#67)
* Bump dependencies for Laravel 12 * Update GitHub Actions for Laravel 12 * Update larastan * Fix styling * Update rector * Fix phpstan * Fix styling --------- Co-authored-by: Shift <shift@laravelshift.com> Co-authored-by: oddvalue <10127404+oddvalue@users.noreply.github.com>
1 parent b07af7f commit e781b78

26 files changed

+229
-49
lines changed

.github/workflows/run-tests.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,28 @@ name: run-tests
22

33
on:
44
push:
5-
branches: [main]
5+
branches:
6+
- main
67
pull_request:
7-
branches: [main]
8+
branches:
9+
- main
810

911
jobs:
1012
test:
1113
runs-on: ${{ matrix.os }}
14+
1215
strategy:
1316
fail-fast: true
1417
matrix:
1518
os: [ubuntu-latest]
16-
php: [ 8.2,8.3,8.4 ]
17-
laravel: [ 11.* ]
19+
php: [8.2, 8.3, 8.4]
20+
laravel: ['11.*', '12.*']
1821
stability: [prefer-stable]
1922
include:
2023
- laravel: 11.*
2124
testbench: 9.*
25+
- laravel: 12.*
26+
testbench: 10.*
2227

2328
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2429

@@ -48,7 +53,7 @@ jobs:
4853

4954
- name: Upload coverage
5055
uses: gaelgirodon/ci-badges-action@v1
51-
if: github.ref == 'refs/heads/main'
56+
if: "github.ref == 'refs/heads/main'"
5257
with:
5358
gist-id: 9dd8e508cb2433728d42a258193770eb
5459
token: ${{ secrets.GIST_TOKEN }}

.pre-commit/phpcs.sh

100644100755
File mode changed.

.pre-commit/rector.sh

100644100755
File mode changed.

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818
],
1919
"require": {
2020
"php": "^8.0",
21-
"illuminate/contracts": "^11.0",
21+
"illuminate/contracts": "^11.0|^12.0",
2222
"spatie/laravel-package-tools": "^1.9.2"
2323
},
2424
"require-dev": {
2525
"friendsofphp/php-cs-fixer": "^3.8",
26-
"nunomaduro/larastan": "^2.0.1",
27-
"orchestra/testbench": "^7.0|^8.0|^9.0",
28-
"pestphp/pest": "^1|^2",
29-
"pestphp/pest-plugin-laravel": "^1.1|^2.0",
26+
"larastan/larastan": "^3.0",
27+
"orchestra/testbench": "^7.0|^8.0|^9.0|^10.0",
28+
"pestphp/pest": "^1|^2|^3.7",
29+
"pestphp/pest-plugin-laravel": "^1.1|^2.0|^3.1",
3030
"phpstan/extension-installer": "^1.1",
31-
"phpstan/phpstan-deprecation-rules": "^1.0",
32-
"phpstan/phpstan-phpunit": "^1.0",
33-
"phpunit/phpunit": "^9.0|^10.0",
34-
"rector/rector": "^1.2",
31+
"phpstan/phpstan-deprecation-rules": "^1.0|^2.0",
32+
"phpstan/phpstan-phpunit": "^1.0|^2.0",
33+
"phpunit/phpunit": "^9.0|^10.0|^11.5.3",
34+
"rector/rector": "^2.0",
3535
"roave/security-advisories": "dev-latest",
3636
"spatie/invade": "^2.0",
3737
"spatie/pest-plugin-test-time": "^1.0|^2.0",

database/factories/PostFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Oddvalue\LaravelDrafts\Database\Factories;
44

5-
use Oddvalue\LaravelDrafts\Tests\Post;
5+
use Oddvalue\LaravelDrafts\Tests\app\Models\Post;
66

77
class PostFactory extends \Illuminate\Database\Eloquent\Factories\Factory
88
{

database/factories/PostSectionFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Oddvalue\LaravelDrafts\Database\Factories;
44

5-
use Oddvalue\LaravelDrafts\Tests\PostSection;
5+
use Oddvalue\LaravelDrafts\Tests\app\Models\PostSection;
66

77
class PostSectionFactory extends \Illuminate\Database\Eloquent\Factories\Factory
88
{

database/factories/SoftDeletingPostFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Oddvalue\LaravelDrafts\Database\Factories;
44

5-
use Oddvalue\LaravelDrafts\Tests\SoftDeletingPost;
5+
use Oddvalue\LaravelDrafts\Tests\app\Models\SoftDeletingPost;
66

77
class SoftDeletingPostFactory extends PostFactory
88
{

database/factories/TagFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Oddvalue\LaravelDrafts\Database\Factories;
44

5-
use Oddvalue\LaravelDrafts\Tests\Tag;
5+
use Oddvalue\LaravelDrafts\Tests\app\Models\Tag;
66

77
class TagFactory extends \Illuminate\Database\Eloquent\Factories\Factory
88
{

phpstan-baseline.neon

Lines changed: 172 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,193 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Builder\\:\\:getModel\\(\\)\\.$#"
4+
message: '#^Call to an undefined method Illuminate\\Contracts\\Database\\Query\\Builder\:\:getModel\(\)\.$#'
5+
identifier: method.notFound
56
count: 2
67
path: src/Scopes/PublishingScope.php
78

89
-
9-
message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Builder\\:\\:withDrafts\\(\\)\\.$#"
10+
message: '#^Call to an undefined method Illuminate\\Contracts\\Database\\Query\\Builder\:\:withDrafts\(\)\.$#'
11+
identifier: method.notFound
1012
count: 1
1113
path: src/Scopes/PublishingScope.php
1214

1315
-
14-
message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Builder\\:\\:withoutDrafts\\(\\)\\.$#"
16+
message: '#^Call to an undefined method Illuminate\\Contracts\\Database\\Query\\Builder\:\:withoutDrafts\(\)\.$#'
17+
identifier: method.notFound
1518
count: 1
1619
path: src/Scopes/PublishingScope.php
1720

1821
-
19-
message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Builder\\:\\:withoutGlobalScope\\(\\)\\.$#"
22+
message: '#^Call to an undefined method Illuminate\\Contracts\\Database\\Query\\Builder\:\:withoutGlobalScope\(\)\.$#'
23+
identifier: method.notFound
2024
count: 3
2125
path: src/Scopes/PublishingScope.php
2226

2327
-
24-
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:getQualifiedIsPublishedColumn\\(\\)\\.$#"
28+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getQualifiedIsPublishedColumn\(\)\.$#'
29+
identifier: method.notFound
2530
count: 1
2631
path: src/Scopes/PublishingScope.php
32+
33+
-
34+
message: '#^Access to an undefined property Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\:\:\$drafts\.$#'
35+
identifier: property.notFound
36+
count: 1
37+
path: tests/app/Models/Post.php
38+
39+
-
40+
message: '#^Access to an undefined property Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\:\:\$is_current\.$#'
41+
identifier: property.notFound
42+
count: 1
43+
path: tests/app/Models/Post.php
44+
45+
-
46+
message: '#^Access to an undefined property Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\:\:\$is_published\.$#'
47+
identifier: property.notFound
48+
count: 1
49+
path: tests/app/Models/Post.php
50+
51+
-
52+
message: '#^Access to undefined constant static\(Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\)\:\:IS_CURRENT\.$#'
53+
identifier: classConstant.notFound
54+
count: 1
55+
path: tests/app/Models/Post.php
56+
57+
-
58+
message: '#^Access to undefined constant static\(Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\)\:\:IS_PUBLISHED\.$#'
59+
identifier: classConstant.notFound
60+
count: 1
61+
path: tests/app/Models/Post.php
62+
63+
-
64+
message: '#^Access to undefined constant static\(Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\)\:\:PUBLISHED_AT\.$#'
65+
identifier: classConstant.notFound
66+
count: 1
67+
path: tests/app/Models/Post.php
68+
69+
-
70+
message: '#^Access to undefined constant static\(Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\)\:\:PUBLISHER_ID\.$#'
71+
identifier: classConstant.notFound
72+
count: 1
73+
path: tests/app/Models/Post.php
74+
75+
-
76+
message: '#^Access to undefined constant static\(Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\)\:\:PUBLISHER_TYPE\.$#'
77+
identifier: classConstant.notFound
78+
count: 1
79+
path: tests/app/Models/Post.php
80+
81+
-
82+
message: '#^Access to undefined constant static\(Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\)\:\:UUID\.$#'
83+
identifier: classConstant.notFound
84+
count: 1
85+
path: tests/app/Models/Post.php
86+
87+
-
88+
message: '#^Attribute class JetBrains\\PhpStorm\\ArrayShape does not exist\.$#'
89+
identifier: attribute.notFound
90+
count: 1
91+
path: tests/app/Models/Post.php
92+
93+
-
94+
message: '#^Call to an undefined method Illuminate\\Contracts\\Database\\Query\\Builder\:\:withDrafts\(\)\.$#'
95+
identifier: method.notFound
96+
count: 1
97+
path: tests/app/Models/Post.php
98+
99+
-
100+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:generateUuid\(\)\.$#'
101+
identifier: method.notFound
102+
count: 1
103+
path: tests/app/Models/Post.php
104+
105+
-
106+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getIsCurrentColumn\(\)\.$#'
107+
identifier: method.notFound
108+
count: 1
109+
path: tests/app/Models/Post.php
110+
111+
-
112+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:getIsPublishedColumn\(\)\.$#'
113+
identifier: method.notFound
114+
count: 1
115+
path: tests/app/Models/Post.php
116+
117+
-
118+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:newRevision\(\)\.$#'
119+
identifier: method.notFound
120+
count: 1
121+
path: tests/app/Models/Post.php
122+
123+
-
124+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:publish\(\)\.$#'
125+
identifier: method.notFound
126+
count: 1
127+
path: tests/app/Models/Post.php
128+
129+
-
130+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:revisions\(\)\.$#'
131+
identifier: method.notFound
132+
count: 3
133+
path: tests/app/Models/Post.php
134+
135+
-
136+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:setLive\(\)\.$#'
137+
identifier: method.notFound
138+
count: 1
139+
path: tests/app/Models/Post.php
140+
141+
-
142+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Model\:\:setPublisher\(\)\.$#'
143+
identifier: method.notFound
144+
count: 1
145+
path: tests/app/Models/Post.php
146+
147+
-
148+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany\:\:current\(\)\.$#'
149+
identifier: method.notFound
150+
count: 2
151+
path: tests/app/Models/Post.php
152+
153+
-
154+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany\:\:onlyDrafts\(\)\.$#'
155+
identifier: method.notFound
156+
count: 1
157+
path: tests/app/Models/Post.php
158+
159+
-
160+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany\:\:published\(\)\.$#'
161+
identifier: method.notFound
162+
count: 2
163+
path: tests/app/Models/Post.php
164+
165+
-
166+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany\:\:withDrafts\(\)\.$#'
167+
identifier: method.notFound
168+
count: 2
169+
path: tests/app/Models/Post.php
170+
171+
-
172+
message: '#^Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany\<static\(Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\), \$this\(Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\)\>\:\:withDrafts\(\)\.$#'
173+
identifier: method.notFound
174+
count: 1
175+
path: tests/app/Models/Post.php
176+
177+
-
178+
message: '#^Call to function property_exists\(\) with \$this\(Oddvalue\\LaravelDrafts\\Tests\\app\\Models\\Post\) and ''draftableRelations'' will always evaluate to true\.$#'
179+
identifier: function.alreadyNarrowedType
180+
count: 1
181+
path: tests/app/Models/Post.php
182+
183+
-
184+
message: '#^Right side of && is always true\.$#'
185+
identifier: booleanAnd.rightAlwaysTrue
186+
count: 1
187+
path: tests/app/Models/Post.php
188+
189+
-
190+
message: '#^Using nullsafe method call on non\-nullable type mixed\. Use \-\> instead\.$#'
191+
identifier: nullsafe.neverNull
192+
count: 1
193+
path: tests/app/Models/Post.php

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ parameters:
77
- src
88
- config
99
- database
10+
- tests/app
1011
tmpDir: build/phpstan
1112
checkOctaneCompatibility: true
1213
checkModelProperties: true

0 commit comments

Comments
 (0)