Repository navigation
Expand file tree
/
Copy pathphpstan.neon
More file actions
232 lines (212 loc) · 11.3 KB
/
Copy pathphpstan.neon
File metadata and controls
232 lines (212 loc) · 11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# Default PHPStan config
# can be overridden by copying this to phpstan.neon
# if that file exists, then that will be used as config
includes:
- ./phpstan-baseline.neon
- phar://phpstan.phar/conf/bleedingEdge.neon
- vendor/spaze/phpstan-disallowed-calls/disallowed-dangerous-calls.neon
- vendor/spaze/phpstan-disallowed-calls/disallowed-execution-calls.neon
- vendor/spaze/phpstan-disallowed-calls/disallowed-insecure-calls.neon
- vendor/hihaho/phpstan-rules/named-argument-manifest.neon
rules:
- Symplify\PHPStanRules\Rules\StringFileAbsolutePathExistsRule
- Symplify\PHPStanRules\Rules\Complexity\NoArrayMapWithArrayCallableRule
- Symplify\PHPStanRules\Rules\Complexity\ForbiddenArrayMethodCallRule
- Symplify\PHPStanRules\Rules\ForbiddenMultipleClassLikeInOneFileRule
- Symplify\PHPStanRules\Rules\NoDynamicNameRule
- Symplify\PHPStanRules\Rules\NoGlobalConstRule
- Symplify\PHPStanRules\Rules\PreventParentMethodVisibilityOverrideRule
- Symplify\PHPStanRules\Rules\Enum\RequireUniqueEnumConstantRule
- Symplify\PHPStanRules\Rules\UppercaseConstantRule
- Symplify\PHPStanRules\Rules\PHPUnit\PublicStaticDataProviderRule
- Symplify\PHPStanRules\Rules\Explicit\NoMissingVariableDimFetchRule
parameters:
# Runs before the Laravel extension's own bootstrap, and defines the
# version constant that extension reads without a guard. See the file.
bootstrapFiles:
- phpstan-bootstrap.php
tmpDir: .cache/phpstan
# symplify/phpstan-rules 14.17 registers its whole rule sets by default.
# This project opts into single rules under `rules:` above instead, so
# every set stays off.
symplify:
naming: false
complexity: false
configurable: false
static: false
modern: false
symfony: false
symfonyConfig: false
doctrine: false
collections: false
phpunit: false
# Lets hihaho/phpstan-rules' RouteBindingReturnTypeExtension infer $this->route('x')
# return types from the Route::model()/Route::bind() declarations in these providers.
routeBindingProviders:
- App\Providers\RouteServiceProvider
# Lets the same extension infer implicit route-model bindings from the controller
# type-hints on these route files (no Route::model/bind declaration needed).
routeFiles:
- routes/settings.php
- routes/web.php
# Produces named-arguments-manifest.json for rector-rules'
# NamedArgumentFromManifestRector — the larastan-resolved positional flags
# rector cannot name on its own. Run phpstan before rector to refresh it.
namedArgumentManifest:
firstPartyNamespaces:
- App
- Database\Factories
- Tests
outputPath: .config/named-arguments-manifest.json
paths:
# `.config/` holds PHP that runs in the application (boost.php,
# pipeline.php). It is not Laravel's `config/`, and nothing else covers it.
- .config
- app
- bootstrap
- config
- database/factories
# Without this path nothing analyses a migration, so a schema change
# ships having passed every check that ran — and any rule that reads
# migration DDL passes while inspecting nothing.
- database/migrations
- database/seeders
- routes
- tests/Feature
- tests/Unit
# tests/Pest.php hosts shared fixture helpers (withJsonLd, jsonLdPage).
# scanFiles lets PHPStan discover those symbols without analysing the
# Pest bootstrap itself (which has its own dynamic-this idioms).
scanFiles:
- tests/Pest.php
type_coverage:
return: 100
param: 100
property: 100
constant: 100
# type_perfect rules ship inside tomasvotruba/type-coverage since the
# standalone rector/type-perfect package was abandoned and merged into it.
type_perfect:
null_over_false: true
no_mixed: false
narrow_param: false
narrow_return: false
no_param_type_removal: true
no_isset_on_object: true
no_empty_on_object: true
cognitive_complexity:
class: 40
function: 20
# The level ranges from 0 to 9 and the latter is the highest level
# more info at https://phpstan.org/user-guide/rule-levels
level: max
strictRules:
allRules: false
reportUnmatchedIgnoredErrors: false
checkOctaneCompatibility: false
noEnvCallsOutsideOfConfig: true
reportMaybesInPropertyPhpDocTypes: false
checkModelProperties: true
checkModelAppends: true
treatPhpDocTypesAsCertain: false
# ignore the following error: Called 'Model::make()' which performs unnecessary work, use 'new Model()'.
noModelMake: false
# Optional for having a clickable link to PHPStorm
editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%'
ignoreErrors:
-
identifier: greaterOrEqual.alwaysTrue
path: config/database.php
-
identifier: method.nonObject
path: tests
-
identifier: method.internalClass
path: tests
-
identifier: property.nonObject
path: tests
-
identifier: typeCoverage.paramTypeCoverage
path: tests
-
identifier: disallowed.function
path: tests/Feature/Auth/EmailVerificationTest.php
- '#Call to an undefined method [a-zA-Z0-9\\_\<\>]+::[a-zA-Z]+\(\)#'
- '#Call to an undefined static method [a-zA-Z0-9\\_]+::[a-zA-Z]+\(\)#'
- '#Call to method [a-zA-Z0-9\\_]+\(\) on an unknown class (static|self)#'
- '#Call to private method trashed\(\) of parent class Database\\Factories\\[a-zA-Z0-9\\_]+#'
- '#Call to an undefined method .*Illuminate\\Database\\Eloquent\\Relations\\.*::withTrashed\(\)#'
- '#Access to an undefined property (Illuminate\\Database\\Eloquent\\Model|App\\Models\\[a-zA-Z\\]+)::\$[a-zA-Z0-9_]+#'
- '#Access to an undefined property (.*|Illuminate\\Database\\Eloquent\\Collection\<int, .*\>)::#'
- '#Call to an undefined method (.*|Illuminate\\Database\\Eloquent\\Collection\<int, .*\>)::#'
- '#Method [a-zA-Z0-9\\_]+::make\(\) should return [a-zA-Z0-9\\_]+ but returns Illuminate\\(Database\\Eloquent|Support)\\Collection<[^>]+\>+#'
- '#Offset \d does not exist on Illuminate\\Database\\Eloquent\\Model+#'
- '#Offset \d does not exist on App\\Models\\+#'
- '#Property App\\Models\\[a-zA-Z\\]+::\$[a-zA-Z0-9_]+ \(Carbon\\(CarbonInterval|CarbonInterface)(\|null)?\) does not accept (float|int)+#'
- '#Call to an undefined method Carbon\\CarbonInterval::toIso8601\(\)#'
- '#Call to an undefined method Staudenmeir\\LaravelAdjacencyList\\Eloquent\\Relations\\Descendants<[^>]+\>::withTrashed\(\)#'
- '#Method App\\Livewire\\[a-zA-Z\\]+::[a-zA-Z0-9\\_]+\(\) never returns Livewire\\Features\\SupportRedirects\\Redirector so it can be removed from the return type+#'
- '#Property App\\Models\\Subtitle::\$type \(App\\Enums\\SubtitleType\|null\) does not accept string+#'
- '#Property App\\Models\\Subtitle::\$source \(App\\Enums\\SubtitleSource\|null\) does not accept string+#'
- '#Property App\\Models\\[a-zA-Z\\]*Video::\$status \(App\\Enums\\Video\\VideoStatus\) does not accept int+#'
- '#Property App\\Models\\[a-zA-Z\\]*Video::\$end_video_metadata \(stdClass\|null\) does not accept array+#'
- '#Property App\\Models\\[a-zA-Z\\]*Video::\$type \(App\\Enums\\Video\\VideoType\|null\) does not accept int+#'
- '#Property App\\Models\\Interaction::\$attributes \(object\|null\) does not accept#'
- '#Property App\\Models\\[a-zA-Z\\]*Video::\$end_video_action \(App\\Enums\\Video\\EndVideoAction\|null\) does not accept int+#'
- '#Property App\\Models\\[a-zA-Z\\]+::\$action \((App\\DataObjects\\Video\\Action\\[a-zA-Z\\]+)(\|null)?\) does not accept (array|App\\DataObjects\\Video\\Action\\[a-zA-Z\\]+)+#'
- '#Method App\\Models(\\[a-zA-Z]+)+::[a-zA-Z]+\(\) return type with generic class Illuminate\\Database\\Eloquent\\Relations\\.* is not subtype of native type Illuminate\\Database\\Eloquent\\Relations\\#'
- '#Parameter (\#\d )?\$locale of function \_\_ expects string(\|null)?, App\\Enums\\Locale#'
- '#Parameter (\#\d )?\$replace of function \_\_ expects array\<string, bool\|float\|int\|string\>, array\<string, Illuminate\\Contracts\\Support\\Htmlable(\|string)?(\|null)?\> given#'
- '#Parameter \#2 \$callback of method Illuminate\\Database\\Eloquent\\Relations\\HasMany<App\\Models\\[a-zA-Z\\]+>::when\(\) expects#'
- '#Parameter \#2 \$callback of method Illuminate\\(Database\\Eloquent|Support)\\Collection<[^>]+\>::when\(\) expects#'
- '#Parameter \#2 \$callback of method Illuminate\\Database\\Eloquent\\Builder#'
- '#Parameter \#1 \$rules of method Laravel\\Nova\\Fields\\Field\:\:rules\(\) expects#'
- '#Parameter \#1 \$[a-zA-Z]+ of method Database\\Factories\\.*::[a-zA-Z]+\(\) expects App\\Models\\#'
- '#Parameter \#1 \$callback of method Illuminate\\Support\\Collection\<.*\>::transform\(\) expects callable\(.*\): .*, Closure\(.*\): .* given.#'
- '#Parameter \#1 \$column of method Illuminate\\Database\\Eloquent\\Builder\<.*\>::[a-zA-Z]+\(\) expects#'
- '#Parameter \$callback of method Illuminate\\Database\\Eloquent\\Builder#'
- '#Unable to resolve the template type (TKey|TValue) in call to function collect#'
- '#Unsafe usage of new static\(\) in#'
- '#Provide more specific return type \"Illuminate\\View\\View\" over abstract one#'
- identifier: method.childParameterType
- identifier: method.childReturnType
- identifier: offsetAccess.nonOffsetAccessible
- identifier: missingType.iterableValue
- identifier: missingType.generics
path: tests
- identifier: property.private
path: tests
- identifier: method.protected
path: tests
- identifier: complexity.classLike
path: tests
- identifier: symplify.noDynamicName
path: tests
- identifier: complexity.classLike
path: app/Policies
- identifier: complexity.classLike
path: app/Models
# Vendor-published migrations (spatie/laravel-health, webpush, passport).
# They read their table and connection names from config, which PHPStan
# resolves as mixed. The path stays analysed so SlowMigrationDdlRule
# still reads their DDL; rewriting
# a published migration would change which connection it targets.
-
identifier: argument.type
paths:
- database/migrations/2026_04_26_171404_create_health_tables.php
- database/migrations/2026_04_27_083838_create_push_subscriptions_table.php
-
identifier: return.type
path: database/migrations/2026_09_06_2229*_create_oauth_*_table.php
# BladeRenderer is marked @internal by sandermuller/project-boost-laravel,
# but registering it is the documented way to render the `.blade.php`
# vendor skills (laravel/mcp, passport, socialite). Without it they are
# skipped silently.
-
identifier: new.internalClass
path: .config/boost.php
excludePaths:
- bootstrap/cache
- .cache