提交 e4950d10 编写于 作者: R Rob Lourens 提交者: GitHub

Merge pull request #22354 from Nais777/master

Update PHP snippets
{ {
"Class Variable": { "class …": {
"prefix": "doc_v", "prefix": "class",
"body": [
"class ${1:ClassName} ${2:extends ${3:AnotherClass}} ${4:implements ${5:Interface}}",
"{",
"\t$0",
"}",
""
],
"description": "Class definition"
},
"PHPDoc class …": {
"prefix": "doc_class",
"body": [ "body": [
"/**", "/**",
" * ${1:undocumented class variable}", " * ${6:undocumented class}",
" *", " */",
" * @var ${2:string}", "class ${1:ClassName} ${2:extends ${3:AnotherClass}} ${4:implements ${5:Interface}}",
" **/", "{",
"${3:var} $$2;$0" "\t$0",
"}",
""
], ],
"description": "Documented Class Variable" "description": "Documented Class Declaration"
}, },
"function __construct": { "function __construct": {
"prefix": "con", "prefix": "con",
"body": [ "body": [
"function __construct(${1:$${2:foo} ${3:= ${4:null}}}) {", "${1:public} function __construct(${2:${3:Type} $${4:var}${5: = ${6:null}}}) {",
"\t${2:$this->$0 = $$0;}", "\t\\$this->${4:var} = $${4:var};$0",
"}" "}"
] ]
}, },
"class …": { "PHPDoc property": {
"prefix": "class", "prefix": "doc_v",
"body": [ "body": [
"/**", "/** @var ${1:Type} $${2:var} ${3:description} */",
" * $1", "${4:protected} $${2:var}${5: = ${6:null}};$0"
" */",
"class ${2:ClassName} ${3:extends ${4:AnotherClass}}",
"{",
"\t$5",
"\tfunction ${6:__construct}(${7:argument})",
"\t{",
"\t\t${0:# code...}",
"\t}",
"}",
""
], ],
"description": "Class definition" "description": "Documented Class Variable"
}, },
"PHPDoc function …": { "PHPDoc function …": {
"prefix": "doc_f", "prefix": "doc_f",
"body": [ "body": [
"/**", "/**",
" * ${6:undocumented function summary}", " * ${1:undocumented function summary}",
" *", " *",
" * ${7:Undocumented function long description}", " * ${2:Undocumented function long description}",
" *", " *",
" * @param ${8:type} ${9:var} ${10:Description}", "${3: * @param ${4:Type} $${5:var} ${6:Description}}",
"${7: * @return ${8:type}}",
"${9: * @throws ${10:conditon}}",
" **/", " **/",
"${1:public }function ${2:FunctionName}(${3:$${4:value}${5:=''}})", "${11:public }function ${12:FunctionName}(${13:${14:${4:Type} }$${5:var}${15: = ${16:null}}})",
"{", "{",
"\t${0:# code...}", "\t${0:# code...}",
"}" "}"
], ],
"description": "Documented function" "description": "Documented function"
}, },
"PHPDoc param …": {
"prefix": "param",
"body": [
"* @param ${1:Type} ${2:var} ${3:Description}$0"
],
"description": "Paramater documentation"
},
"function …": { "function …": {
"prefix": "fun", "prefix": "fun",
"body": [ "body": [
"${1:public }function ${2:FunctionName}(${3:$${4:value}${5:=''}})", "${1:public }function ${2:FunctionName}(${3:${4:${5:Type} }$${6:var}${7: = ${8:null}}})",
"{", "{",
"\t${0:# code...}", "\t${0:# code...}",
"}" "}"
...@@ -72,10 +84,7 @@ ...@@ -72,10 +84,7 @@
" */", " */",
"trait ${2:TraitName}", "trait ${2:TraitName}",
"{", "{",
"\tfunction ${3:functionName}(${4:argument})", "\t$0",
"\t{",
"\t\t${5:# code...}",
"\t}",
"}", "}",
"" ""
], ],
...@@ -94,21 +103,18 @@ ...@@ -94,21 +103,18 @@
"body": [ "body": [
"do {", "do {",
"\t${0:# code...}", "\t${0:# code...}",
"} while (${1:${2:$a} <= ${3:10}});" "} while (${1:$${2:a} <= ${3:10}});"
], ],
"description": "Do-While loop" "description": "Do-While loop"
}, },
"if … else …": { "while …": {
"prefix": "ifelse", "prefix": "while",
"body": [ "body": [
"if (${1:condition}) {", "while (${1:$${2:a} <= ${3:10}}) {",
"\t${2:# code...}", "\t${0:# code...}",
"} else {", "}"
"\t${3:# code...}",
"}",
"$0"
], ],
"description": "If Else block" "description": "While-loop"
}, },
"if …": { "if …": {
"prefix": "if", "prefix": "if",
...@@ -119,6 +125,18 @@ ...@@ -119,6 +125,18 @@
], ],
"description": "If block" "description": "If block"
}, },
"if … else …": {
"prefix": "ifelse",
"body": [
"if (${1:condition}) {",
"\t${2:# code...}",
"} else {",
"\t${3:# code...}",
"}",
"$0"
],
"description": "If Else block"
},
"$… = ( … ) ? … : …": { "$… = ( … ) ? … : …": {
"prefix": "if?", "prefix": "if?",
"body": "$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b} ;", "body": "$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b} ;",
...@@ -178,7 +196,7 @@ ...@@ -178,7 +196,7 @@
"switch …": { "switch …": {
"prefix": "switch", "prefix": "switch",
"body": [ "body": [
"switch (${1:variable}) {", "switch (\\$${1:variable}) {",
"\tcase '${2:value}':", "\tcase '${2:value}':",
"\t\t${3:# code...}", "\t\t${3:# code...}",
"\t\tbreak;", "\t\tbreak;",
...@@ -193,7 +211,7 @@ ...@@ -193,7 +211,7 @@
"case …": { "case …": {
"prefix": "case", "prefix": "case",
"body": [ "body": [
"case '${1:variable}':", "case '${1:value}':",
"\t${0:# code...}", "\t${0:# code...}",
"\tbreak;" "\tbreak;"
], ],
...@@ -201,12 +219,12 @@ ...@@ -201,12 +219,12 @@
}, },
"$this->…": { "$this->…": {
"prefix": "this", "prefix": "this",
"body": "$this->$0", "body": "\\$this->$0;",
"description": "$this->..." "description": "$this->..."
}, },
"echo $this->…": { "echo $this->…": {
"prefix": "ethis", "prefix": "ethis",
"body": "echo $this->$0", "body": "echo \\$this->$0;",
"description": "Echo this" "description": "Echo this"
}, },
"Throw Exception": { "Throw Exception": {
...@@ -216,14 +234,5 @@ ...@@ -216,14 +234,5 @@
"$0" "$0"
], ],
"description": "Throw exception" "description": "Throw exception"
},
"while …": {
"prefix": "while",
"body": [
"while (${1:$a <= 10}) {",
"\t${0:# code...}",
"}"
],
"description": "While-loop"
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册