Skip to content

Commit 047b9cd

Browse files
authored
Restore preexisting php snippets (microsoft#182929)
That shouldn't have been deleted in microsoft#174889 And also bring back one constructor snippet
1 parent 33164f0 commit 047b9cd

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

extensions/php/snippets/php.code-snippets

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@
6868
],
6969
"description": "Class definition"
7070
},
71+
"class __construct": {
72+
"prefix": "construct",
73+
"body": [
74+
"${1|public,private,protected|} function __construct(${2:${3:Type} $${4:var}${5: = ${6:null}}}$7) {",
75+
"\t\\$this->${4:var} = $${4:var};$0",
76+
"}"
77+
]
78+
},
7179
"class function …": {
7280
"prefix": "class_fun",
7381
"body": [
@@ -108,6 +116,24 @@
108116
],
109117
"description": "Do-While loop"
110118
},
119+
"else …": {
120+
"prefix": "else",
121+
"body": [
122+
"else {",
123+
"\t${0:# code...}",
124+
"}"
125+
],
126+
"description": "Else block"
127+
},
128+
"elseif …": {
129+
"prefix": "elseif",
130+
"body": [
131+
"elseif (${1:condition}) {",
132+
"\t${0:# code...}",
133+
"}"
134+
],
135+
"description": "Elseif block"
136+
},
111137
"for …": {
112138
"prefix": "for",
113139
"body": [
@@ -276,6 +302,19 @@
276302
],
277303
"description": "Switch block"
278304
},
305+
"$this->…": {
306+
"prefix": "this",
307+
"body": "\\$this->$0;",
308+
"description": "$this->..."
309+
},
310+
"Throw Exception": {
311+
"prefix": "throw",
312+
"body": [
313+
"throw new $1Exception(${2:\"${3:Error Processing Request}\"}${4:, ${5:1}});",
314+
"$0"
315+
],
316+
"description": "Throw exception"
317+
},
279318
"trait …": {
280319
"prefix": "trait",
281320
"body": [

0 commit comments

Comments
 (0)