Skip to content

Commit cf3c70e

Browse files
authored
ide.json: one code generation instead of two (#45)
Combine code generations for int and string backed enums into one with a dropdown.
1 parent 417de7b commit cf3c70e

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

ide.json

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,21 @@
22
"$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
33
"codeGenerations": [
44
{
5-
"id": "webfox.create-string-backed-enum",
6-
"name": "Create String Backed Enum",
5+
"id": "webfox.create-backed-enum",
6+
"name": "Create Backed Enum",
77
"classSuffix": "Enum",
8-
"files": [
8+
"parameters": [
99
{
10-
"appNamespace": "Enums",
11-
"name": "${INPUT_CLASS|className|upperCamelCase}.php",
12-
"template": {
13-
"type": "stub",
14-
"path": "/stubs/laravel-backed-enum.stub",
15-
"fallbackPath": "stubs/laravel-backed-enum.stub",
16-
"parameters": {
17-
"{{ class }}": "${INPUT_CLASS|className|upperCamelCase}",
18-
"{{ namespace }}": "${INPUT_FQN|namespace}",
19-
"{{ value }}": "'standard'",
20-
"{{ type }}": "string"
21-
}
22-
}
10+
"id": "webfox.create-backed-enum:type",
11+
"name": "Type",
12+
"type": "combobox",
13+
"options": {
14+
"string": "string",
15+
"int": "int"
16+
},
17+
"variable": "TYPE"
2318
}
24-
]
25-
},
26-
{
27-
"id": "webfox.create-int-backed-enum",
28-
"name": "Create Integer Backed Enum",
29-
"classSuffix": "Enum",
19+
],
3020
"files": [
3121
{
3222
"appNamespace": "Enums",
@@ -38,8 +28,8 @@
3828
"parameters": {
3929
"{{ class }}": "${INPUT_CLASS|className|upperCamelCase}",
4030
"{{ namespace }}": "${INPUT_FQN|namespace}",
41-
"{{ value }}": "0",
42-
"{{ type }}": "int"
31+
"{{ value }}": "${TYPE|replace:string,'standard'|replace:int,0}",
32+
"{{ type }}": "${TYPE}"
4333
}
4434
}
4535
}

0 commit comments

Comments
 (0)