Repository navigation
Expand file tree
/
Copy pathconfig-schema.json
More file actions
388 lines (388 loc) · 20.4 KB
/
Copy pathconfig-schema.json
File metadata and controls
388 lines (388 loc) · 20.4 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
{
"$schema": "http://json-schema.org/draft-04/schema",
"$comment": "`taplo` and the corresponding VS Code plugins only support version draft-04 of JSON Schema, see <https://taplo.tamasfe.dev/configuration/developing-schemas.html>. draft-07 is mostly compatible with it, newer versions may not be.",
"title": "PHPantom Configuration",
"description": "User configuration schema for .phpantom.toml: per-project settings for the PHPantom PHP language server.",
"type": "object",
"properties": {
"php": {
"type": "object",
"description": "PHP version and language settings.",
"properties": {
"version": {
"type": "string",
"description": "Override the detected PHP version (e.g. \"8.3\"). When unset, PHPantom infers from composer.json's platform or require.php.",
"pattern": "^\\d+\\.\\d+(\\.\\d+)?$"
}
}
},
"diagnostics": {
"type": "object",
"description": "Toggle individual diagnostic providers.",
"properties": {
"enabled": {
"type": "boolean",
"description": "Show diagnostics in the editor at all. Set to false to report nothing: no native diagnostics (syntax errors included), no external tool runs, and no workspace pass. The analyze command ignores this setting.",
"default": true
},
"unresolved-member-access": {
"type": "boolean",
"description": "Report member access (->, ?->, ::) on subjects whose type could not be resolved. Useful for discovering gaps in type coverage but produces too many diagnostics on codebases without comprehensive type annotations.",
"default": false
},
"extra-arguments": {
"type": "boolean",
"description": "Report calls that pass more arguments than the function accepts. PHP silently ignores extra arguments to user-defined functions, and many libraries exploit this for flexible APIs.",
"default": false
},
"magic-properties": {
"type": "boolean",
"description": "Report unknown property access on classes with __get when virtual properties are defined (via @property docblock tags, Laravel Eloquent column inference, or other providers). Matches PHPStan's reportMagicProperties behaviour.",
"default": false
},
"partial-union-members": {
"type": "boolean",
"description": "Report a member access on a union when only some of its classes declare the member, since the access fails whenever one of the others arrives. Matches PHPStan's checkUnionTypes (level 7).",
"default": false
},
"possibly-empty-mismatches": {
"type": "boolean",
"description": "Report a type_mismatch_argument, type_mismatch_return or type_mismatch_property whose only failing members are null or false, such as a string|false passed to a string parameter. Off by default, since the code only fails if the value turns out empty. Matches PHPStan's checkUnionTypes and checkNullables (levels 7 and 8).",
"default": false
},
"partial-union-mismatches": {
"type": "boolean",
"description": "Report a type_mismatch_argument, type_mismatch_return or type_mismatch_property where some members of the value's union fit the declared type, such as an array|string passed to a string parameter. On by default. Set to false to only report a value no member of which fits, the way PHPStan below level 7 judges unions. That also leaves out the mismatches possibly-empty-mismatches covers.",
"default": true
},
"docblock-type-mismatches": {
"type": "boolean",
"description": "Check arguments, return values and property assignments against the types docblocks declare. On by default. Set to false to report a type_mismatch_argument, type_mismatch_return or type_mismatch_property only when the value breaks the native type, so a parameter, return or property typed only in a docblock is not checked. Useful on legacy code whose docblocks have drifted from what the code does.",
"default": true
},
"unhandled-exceptions": {
"type": "boolean",
"description": "Report a throw, or a call whose callee declares @throws, where the exception is neither caught nor covered by a @throws tag of the enclosing function or method. Exceptions extending a class in unchecked-exceptions are not reported.",
"default": false
},
"unused-parameters": {
"type": "boolean",
"description": "Report a parameter a function, closure, or method never reads, after the last one it does read. Methods whose signature an interface, a parent class, or a possible override dictates are left alone, and so are parameters named with a $_ prefix.",
"default": false
},
"unchecked-exceptions": {
"type": "array",
"items": { "type": "string" },
"description": "Exception classes, fully qualified, that unhandled-exceptions does not report, along with every class extending them.",
"default": ["Error", "LogicException", "RuntimeException"]
},
"workspace": {
"type": "boolean",
"description": "Compute diagnostics for the whole workspace in the background after startup and the full index finish, so project-wide problems appear for files that are not open in the editor. Off by default: it costs a project-wide sweep every session. Requires the default \"full\" indexing strategy.",
"default": false
},
"workspace-external": {
"type": "boolean",
"description": "Run configured external tools (PHPStan, PHPCS, PHPMD, Mago) once over the whole project after workspace diagnostics finish. Only takes effect when \"workspace\" is enabled. Each tool only runs when it is enabled and has its own project-level configuration file (phpstan.neon, phpcs.xml, phpmd.yml, mago.toml).",
"default": true
},
"ignore": {
"type": "array",
"description": "Rules that suppress matching diagnostics, similar to PHPStan's ignoreErrors. Each rule may constrain by message (regex), path (glob relative to workspace root), and/or identifier (diagnostic code). A diagnostic is suppressed when it matches every constraint present on a rule; omitted constraints match anything.",
"items": {
"type": "object",
"description": "A single ignore rule. At least one constraint (message, path, or identifier) must be present.",
"properties": {
"message": {
"type": "string",
"description": "Regex matched against the diagnostic message."
},
"path": {
"type": "string",
"description": "Glob matched against the file path relative to the workspace root. Follows gitignore-style glob syntax: * does not cross /, use ** to match across directories."
},
"identifier": {
"type": "string",
"description": "Diagnostic identifier (the diagnostic code, e.g. \"unused_import\", \"deprecated_usage\")."
}
}
}
}
}
},
"indexing": {
"type": "object",
"description": "Controls how PHPantom discovers classes across the workspace.",
"properties": {
"strategy": {
"type": "string",
"description": "The indexing strategy for class discovery. \"full\" (default): scan PHP files, then background-parse user files to populate symbol and reference indexes. \"composer\": use Composer's classmap, fall back to self-scan. \"self\": scan all PHP files, ignore classmap. \"none\": no proactive scanning, classmap only.",
"enum": [
"composer",
"self",
"full",
"none"
],
"default": "full"
},
"exclude": {
"type": "array",
"items": {
"type": "string"
},
"description": "Paths the workspace scanners skip, in gitignore syntax relative to the workspace root: a bare name matches at any depth, a pattern containing / anchors to the root, a trailing / restricts to directories, and a leading ! undoes an earlier pattern (use include to bring back a hidden, gitignored, or built-in skipped path). Applies to background discovery and to the directories analyze walks. A file you open in the editor, or name outright on the analyze command line, is always served.",
"default": []
},
"extensions": {
"type": "array",
"items": {
"type": "string"
},
"description": "Extra file extensions (without the dot) treated as PHP source during workspace discovery, e.g. [\"module\", \"inc\", \"theme\"] for Drupal. .php is always included.",
"default": []
},
"include": {
"type": "array",
"items": {
"type": "string"
},
"description": "Files and directories to index even though the workspace scan skips them (hidden, gitignored, or the laravel-ide-helper files), relative to the workspace root unless absolute. Directories are walked recursively, files are scanned directly, and entries that do not exist are ignored. Paths inside the workspace are treated as project code; paths outside it as library code, like vendor. Included paths fill gaps and never override a declaration found elsewhere.",
"default": []
}
}
},
"stubs": {
"type": "object",
"description": "Stub files whose declarations win over every other declaration of the same name.",
"properties": {
"paths": {
"type": "array",
"items": {
"type": "string"
},
"description": "Stub files and directories, relative to the workspace root unless absolute. A class, function, or constant declared here is what the name means, whatever the project, its dependencies, or PHP's built-in stubs declare under it. Directories are walked recursively, hidden and gitignored entries included, and entries that do not exist are ignored. Earlier entries win over later ones. Stub files are never analysed or edited. Use indexing.include instead for code that should only fill gaps.",
"default": []
}
}
},
"semantic-tokens": {
"type": "object",
"description": "Controls LSP semantic token highlighting.",
"properties": {
"mode": {
"type": "string",
"description": "Semantic token emission mode. \"contextual\" emits only context-sensitive tokens that complement editor syntax highlighting. \"full\" emits the complete semantic token stream. \"off\" disables semantic tokens.",
"enum": [
"contextual",
"full",
"off"
],
"default": "contextual"
}
}
},
"inlay-hints": {
"type": "object",
"description": "Controls which kinds of inlay hint are shown. The editor can switch a kind off too, but cannot switch one back on over this section.",
"properties": {
"parameter-names": {
"type": "boolean",
"description": "Parameter names before the arguments of a call, such as `needle:`, along with the `&` of a by-reference parameter.",
"default": true
},
"closure-types": {
"type": "boolean",
"description": "Inferred parameter and return types on closures and arrow functions that do not declare them.",
"default": true
}
}
},
"laravel": {
"type": "object",
"description": "Laravel-specific analysis settings.",
"properties": {
"schema": {
"type": "object",
"description": "Controls Laravel database schema dump scanning for Eloquent model property inference.",
"properties": {
"enabled": {
"type": "boolean",
"description": "Enable Laravel schema dump scanning. When enabled, PHPantom scans database/schema by default.",
"default": true
},
"paths": {
"type": "array",
"description": "Schema dump files or directories to scan, relative to the workspace root unless absolute. Defaults to [\"database/schema\"].",
"items": {
"type": "string"
},
"default": [
"database/schema"
]
}
}
},
"migrations": {
"type": "object",
"description": "Controls Laravel migration scanning for Eloquent model property inference.",
"properties": {
"enabled": {
"type": "boolean",
"description": "Enable Laravel migration scanning. When enabled, PHPantom scans direct PHP files in non-vendor database/migrations directories by default.",
"default": true
},
"paths": {
"type": "array",
"description": "Migration files or directories to scan, relative to the workspace root unless absolute. Direct PHP files in directories are scanned; subdirectories are not scanned.",
"items": {
"type": "string"
}
}
}
}
}
},
"formatting": {
"type": "object",
"description": "Controls the formatting strategy. PHPantom ships a built-in formatter (PER-CS 2.0 style). Projects with php-cs-fixer or PHP_CodeSniffer in composer.json require-dev automatically use those tools instead. Explicit configuration here always takes priority.",
"properties": {
"enabled": {
"type": "boolean",
"description": "Whether formatting is enabled at all. Unset or true: format with the resolved strategy. false: answer no formatting requests, the built-in formatter included."
},
"pint": {
"type": "string",
"description": "Command or path to run Laravel Pint. Unset: auto-detect from composer.json require-dev. Empty string: disable Pint. Any other value: use as the command."
},
"pint-blade": {
"type": "boolean",
"description": "Whether .blade.php files are formatted by Pint's Pint/laravel_blade rule. Unset: follow the workspace pint.json. true: send them to Pint with --blade. false: never."
},
"blade-formatter": {
"type": "string",
"description": "Command or path to run blade-formatter on .blade.php files. Unset: use node_modules/.bin/blade-formatter when package.json lists blade-formatter, the workspace root has a .bladeformatterrc.json or .bladeformatterrc, and Pint does not format Blade. Empty string: never. Any other value: always, even over Pint."
},
"blade-php": {
"type": "boolean",
"description": "Whether the built-in Blade formatter also formats the PHP a template carries. Unset: leave every fragment as written. true: format it. No effect when Blade files go to Pint or blade-formatter."
},
"php-cs-fixer": {
"type": "string",
"description": "Command or path to run php-cs-fixer. Unset: auto-detect from composer.json require-dev. Empty string: disable php-cs-fixer. Any other value: use as the command."
},
"phpcbf": {
"type": "string",
"description": "Command or path to run phpcbf. Unset: auto-detect from composer.json require-dev. Empty string: disable phpcbf. Any other value: use as the command."
},
"timeout": {
"type": "integer",
"description": "Maximum runtime in milliseconds per external formatting tool before it is killed. Applied per tool, not for the combined pipeline.",
"default": 10000,
"minimum": 0
}
}
},
"phpstan": {
"type": "object",
"description": "PHPStan proxy settings. PHPantom can run PHPStan in editor mode on each file save and surface its errors as LSP diagnostics.",
"properties": {
"command": {
"type": "string",
"description": "Command or path to run PHPStan. Unset: auto-detect via vendor/bin/phpstan then $PATH. Empty string: disable PHPStan integration. Any other value: use as the command."
},
"memory-limit": {
"type": "string",
"description": "Memory limit passed to PHPStan via --memory-limit.",
"default": "1G"
},
"timeout": {
"type": "integer",
"description": "Maximum runtime in milliseconds before PHPStan is killed.",
"default": 60000,
"minimum": 0
}
}
},
"phpcs": {
"type": "object",
"description": "PHP_CodeSniffer proxy settings. PHPantom can run PHPCS on each file save and surface its findings as LSP diagnostics.",
"properties": {
"command": {
"type": "string",
"description": "Command or path to run PHPCS. Unset: auto-detect via vendor/bin/phpcs then $PATH. Empty string: disable PHPCS integration. Any other value: use as the command."
},
"standard": {
"type": "string",
"description": "Coding standard to enforce (e.g. \"PSR12\"). phpcbf fixes against the same standard. Unset: PHPCS uses its own default detection (phpcs.xml / phpcs.xml.dist in the project root, then its built-in default)."
},
"timeout": {
"type": "integer",
"description": "Maximum runtime in milliseconds before PHPCS is killed.",
"default": 30000,
"minimum": 0
}
}
},
"phpmd": {
"type": "object",
"description": "PHP Mess Detector proxy settings. PHPantom can run PHPMD 3 on each file save and surface its findings as LSP diagnostics.",
"properties": {
"command": {
"type": "string",
"description": "Command or path to run PHPMD. Unset: auto-detect via vendor/bin/phpmd then $PATH, only when the project has a PHPMD config file (phpmd.yml, phpmd.xml, ...) or ruleset is set. Empty string: disable PHPMD integration. Any other value: use as the command."
},
"ruleset": {
"type": "string",
"description": "Ruleset name or file passed via --ruleset (e.g. \"cleancode\"). Unset: PHPMD uses the config file it finds in the project root."
},
"timeout": {
"type": "integer",
"description": "Maximum runtime in milliseconds before PHPMD is killed.",
"default": 30000,
"minimum": 0
}
}
},
"mago": {
"type": "object",
"description": "Mago proxy settings. Mago is only activated when mago.toml exists at the workspace root. PHPantom can run mago lint and mago analyze on each file save and surface their findings as LSP diagnostics.",
"properties": {
"command": {
"type": "string",
"description": "Command or path to run Mago. Unset: auto-detect via vendor/bin/mago then $PATH. Empty string: disable Mago integration. Any other value: use as the command."
},
"lint": {
"type": "boolean",
"description": "Proxy mago lint diagnostics. Unset: only when mago.toml has a [linter] table."
},
"analyze": {
"type": "boolean",
"description": "Proxy mago analyze diagnostics. Unset: only when mago.toml has an [analyzer] table, and on a Laravel project only when it also wires up an extension, since Mago's analyser cannot otherwise see through Eloquent or the facades."
},
"lint-timeout": {
"type": "integer",
"description": "Maximum runtime in milliseconds before mago lint is killed.",
"default": 30000,
"minimum": 0
},
"analyze-timeout": {
"type": "integer",
"description": "Maximum runtime in milliseconds before mago analyze is killed.",
"default": 60000,
"minimum": 0
}
}
},
"trust": {
"type": "object",
"description": "Which workspaces may run the project's own tools (PHPStan, PHP_CodeSniffer, PHPMD, Mago, external formatters). Only read from the global config; a project's .phpantom.toml cannot set it.",
"properties": {
"all-workspaces": {
"type": "boolean",
"description": "Trust every workspace, so project tools run without asking. These tools execute code from the project, so only set this if you never open code you don't trust.",
"default": false
}
}
}
}
}