Update PHP snippits

This commit is contained in:
Jacob Lambert 2017-03-09 21:23:15 -07:00
parent db35205c7c
commit 9f8dd87d48

View file

@ -1,63 +1,75 @@
{
"Class Variable": {
"prefix": "doc_v",
"body": [
"/**",
" * ${1:undocumented class variable}",
" *",
" * @var ${2:string}",
" **/",
"${3:var} $$2;$0"
],
"description": "Documented Class Variable"
},
"function __construct": {
"prefix": "con",
"body": [
"function __construct(${1:$${2:foo} ${3:= ${4:null}}}) {",
"\t${2:$this->$0 = $$0;}",
"}"
]
},
"class …": {
"prefix": "class",
"body": [
"/**",
" * $1",
" */",
"class ${2:ClassName} ${3:extends ${4:AnotherClass}}",
"class ${1:ClassName} ${2:extends ${3:AnotherClass}} ${4:implements ${5:Interface}}",
"{",
"\t$5",
"\tfunction ${6:__construct}(${7:argument})",
"\t{",
"\t\t${0:# code...}",
"\t}",
"\t$0",
"}",
""
],
"description": "Class definition"
},
"PHPDoc class …": {
"prefix": "doc_class",
"body": [
"/**",
" * ${6:undocumented class}",
" */",
"class ${1:ClassName} ${2:extends ${3:AnotherClass}} ${4:implements ${5:Interface}}",
"{",
"\t$0",
"}",
""
],
"description": "Documented Class Declaration"
},
"function __construct": {
"prefix": "con",
"body": [
"${1:public} function __construct(${2:${3:Type} $${4:var}${5: = ${6:null}}}) {",
"\t\\$this->${4:var} = $${4:var};$0",
"}"
]
},
"PHPDoc property": {
"prefix": "doc_v",
"body": [
"/** @var ${1:Type} $${2:var} ${3:description} */",
"${4:protected} $${2:var}${5: = ${6:null}};$0"
],
"description": "Documented Class Variable"
},
"PHPDoc function …": {
"prefix": "doc_f",
"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...}",
"}"
],
"description": "Documented function"
},
"PHPDoc param …": {
"prefix": "param",
"body": [
"* @param ${1:Type} ${2:var} ${3:Description}$0"
],
"description": "Paramater documentation"
},
"function …": {
"prefix": "fun",
"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...}",
"}"
@ -72,10 +84,7 @@
" */",
"trait ${2:TraitName}",
"{",
"\tfunction ${3:functionName}(${4:argument})",
"\t{",
"\t\t${5:# code...}",
"\t}",
"\t$0",
"}",
""
],
@ -94,9 +103,27 @@
"body": [
"do {",
"\t${0:# code...}",
"} while (${1:${2:$a} <= ${3:10}});"
"} while (${1:$${2:a} <= ${3:10}});"
],
"description": "Do-While loop"
},
"while …": {
"prefix": "while",
"body": [
"while (${1:$${2:a} <= ${3:10}}) {",
"\t${0:# code...}",
"}"
],
"description": "While-loop"
},
"if …": {
"prefix": "if",
"body": [
"if (${1:condition}) {",
"\t${0:# code...}",
"}"
],
"description": "If block"
},
"if … else …": {
"prefix": "ifelse",
@ -110,15 +137,6 @@
],
"description": "If Else block"
},
"if …": {
"prefix": "if",
"body": [
"if (${1:condition}) {",
"\t${0:# code...}",
"}"
],
"description": "If block"
},
"$… = ( … ) ? … : …": {
"prefix": "if?",
"body": "$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b} ;",
@ -178,7 +196,7 @@
"switch …": {
"prefix": "switch",
"body": [
"switch (${1:variable}) {",
"switch (\\$${1:variable}) {",
"\tcase '${2:value}':",
"\t\t${3:# code...}",
"\t\tbreak;",
@ -193,7 +211,7 @@
"case …": {
"prefix": "case",
"body": [
"case '${1:variable}':",
"case '${1:value}':",
"\t${0:# code...}",
"\tbreak;"
],
@ -201,12 +219,12 @@
},
"$this->…": {
"prefix": "this",
"body": "$this->$0",
"body": "\\$this->$0;",
"description": "$this->..."
},
"echo $this->…": {
"prefix": "ethis",
"body": "echo $this->$0",
"body": "echo \\$this->$0;",
"description": "Echo this"
},
"Throw Exception": {
@ -216,14 +234,5 @@
"$0"
],
"description": "Throw exception"
},
"while …": {
"prefix": "while",
"body": [
"while (${1:$a <= 10}) {",
"\t${0:# code...}",
"}"
],
"description": "While-loop"
}
}