Skip to content

Commit 606e0d8

Browse files
committed
Use PHPStan 2
1 parent a5118f5 commit 606e0d8

File tree

3 files changed

+63
-22
lines changed

3 files changed

+63
-22
lines changed

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
},
1818
"require-dev": {
1919
"php-coveralls/php-coveralls": "^2.7.0",
20-
"phpstan/phpstan": "^1.10",
20+
"phpstan/phpstan": "^2.1",
2121
"phpunit/phpunit": "^10.0",
2222
"slevomat/coding-standard": "^8.15",
2323
"squizlabs/php_codesniffer": "^3.5",
24-
"supportpal/coding-standard": "^0.4"
24+
"supportpal/coding-standard": "^0.4",
25+
"phpstan/phpstan-phpunit": "^2.0"
2526
},
2627
"autoload": {
2728
"psr-4": {

phpstan-baseline.neon

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,139 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{static\\(Jenssegers\\\\Model\\\\Model\\), string\\} given\\.$#"
4+
message: '#^Parameter \#1 \$callback of function call_user_func_array expects callable\(\)\: mixed, array\{static\(Jenssegers\\Model\\Model\), string\} given\.$#'
5+
identifier: argument.type
56
count: 1
67
path: src/Model.php
78

89
-
9-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
10+
message: '#^Unsafe usage of new static\(\)\.$#'
11+
identifier: new.static
1012
count: 4
1113
path: src/Model.php
1214

1315
-
14-
message: "#^Access to an undefined property Jenssegers\\\\Model\\\\Model\\:\\:\\$name\\.$#"
16+
message: '#^Access to an undefined property Jenssegers\\Model\\Model\:\:\$name\.$#'
17+
identifier: property.notFound
1518
count: 1
1619
path: tests/ModelTest.php
1720

1821
-
19-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$active\\.$#"
22+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$active\.$#'
23+
identifier: property.notFound
2024
count: 1
2125
path: tests/ModelTest.php
2226

2327
-
24-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$age\\.$#"
28+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$age\.$#'
29+
identifier: property.notFound
2530
count: 1
2631
path: tests/ModelTest.php
2732

2833
-
29-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$bar\\.$#"
34+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$bar\.$#'
35+
identifier: property.notFound
3036
count: 1
3137
path: tests/ModelTest.php
3238

3339
-
34-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$birthday\\.$#"
40+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$birthday\.$#'
41+
identifier: property.notFound
3542
count: 1
3643
path: tests/ModelTest.php
3744

3845
-
39-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$city\\.$#"
46+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$city\.$#'
47+
identifier: property.notFound
4048
count: 3
4149
path: tests/ModelTest.php
4250

4351
-
44-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$collection_data\\.$#"
52+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$collection_data\.$#'
53+
identifier: property.notFound
4554
count: 1
4655
path: tests/ModelTest.php
4756

4857
-
49-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$count\\.$#"
58+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$count\.$#'
59+
identifier: property.notFound
5060
count: 1
5161
path: tests/ModelTest.php
5262

5363
-
54-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$data\\.$#"
64+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$data\.$#'
65+
identifier: property.notFound
5566
count: 1
5667
path: tests/ModelTest.php
5768

5869
-
59-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$default\\.$#"
70+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$default\.$#'
71+
identifier: property.notFound
6072
count: 1
6173
path: tests/ModelTest.php
6274

6375
-
64-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$foo\\.$#"
76+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$foo\.$#'
77+
identifier: property.notFound
6578
count: 4
6679
path: tests/ModelTest.php
6780

6881
-
69-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$list_items\\.$#"
82+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$list_items\.$#'
83+
identifier: property.notFound
7084
count: 2
7185
path: tests/ModelTest.php
7286

7387
-
74-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$name\\.$#"
88+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$name\.$#'
89+
identifier: property.notFound
7590
count: 10
7691
path: tests/ModelTest.php
7792

7893
-
79-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$object_data\\.$#"
94+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$object_data\.$#'
95+
identifier: property.notFound
8096
count: 1
8197
path: tests/ModelTest.php
8298

8399
-
84-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$password\\.$#"
100+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$password\.$#'
101+
identifier: property.notFound
85102
count: 2
86103
path: tests/ModelTest.php
87104

88105
-
89-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$score\\.$#"
106+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$score\.$#'
107+
identifier: property.notFound
90108
count: 1
91109
path: tests/ModelTest.php
92110

93111
-
94-
message: "#^Access to an undefined property Tests\\\\Stubs\\\\ModelStub\\:\\:\\$secret\\.$#"
112+
message: '#^Access to an undefined property Tests\\Stubs\\ModelStub\:\:\$secret\.$#'
113+
identifier: property.notFound
95114
count: 2
96115
path: tests/ModelTest.php
97116

98117
-
99-
message: "#^Parameter \\#1 \\$callback of static method Jenssegers\\\\Model\\\\Model\\:\\:unguarded\\(\\) expects callable\\(\\)\\: mixed, array\\{PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&stdClass, 'callback'\\} given\\.$#"
118+
message: '#^Call to function is_array\(\) with array will always evaluate to true\.$#'
119+
identifier: function.alreadyNarrowedType
120+
count: 2
121+
path: tests/ModelTest.php
122+
123+
-
124+
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''\\\\Illuminate\\\\Support…'' and array\{array\{foo\: ''bar'', baz\: ''bat''\}\} will always evaluate to false\.$#'
125+
identifier: method.impossibleType
126+
count: 1
127+
path: tests/ModelTest.php
128+
129+
-
130+
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''\\\\stdClass'' and array\{foo\: ''bar''\} will always evaluate to false\.$#'
131+
identifier: method.impossibleType
132+
count: 1
133+
path: tests/ModelTest.php
134+
135+
-
136+
message: '#^Parameter \#1 \$callback of static method Jenssegers\\Model\\Model\:\:unguarded\(\) expects callable\(\)\: mixed, array\{PHPUnit\\Framework\\MockObject\\MockObject&stdClass, ''callback''\} given\.$#'
137+
identifier: argument.type
100138
count: 1
101139
path: tests/ModelTest.php

phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
includes:
2+
- vendor/phpstan/phpstan-phpunit/extension.neon
23
- phpstan-baseline.neon
34

45
parameters:
@@ -8,3 +9,4 @@ parameters:
89
- tests
910
parallel:
1011
processTimeout: 300.0
12+
treatPhpDocTypesAsCertain: false

0 commit comments

Comments
 (0)