Skip to content

Instantly share code, notes, and snippets.

@DanJFletcher
Created February 18, 2017 15:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanJFletcher/750f01cb9d5308d2bcf6106ae63948b6 to your computer and use it in GitHub Desktop.
Save DanJFletcher/750f01cb9d5308d2bcf6106ae63948b6 to your computer and use it in GitHub Desktop.
PHP snippets for VS Code
{
/*
// Place your snippets for PHP here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
"Make PSR-2 public function": {
"prefix": "pubfunct",
"body": [
"/**",
" * ${1:Description}",
" *",
" * @return ${2:return type}",
" */",
"public function ${3:functionName}($4)",
"{",
" // code away brother$0",
"}"
],
"description": "Generates a PSR-2 formatted public function stub"
},
"Make PSR-2 private function": {
"prefix": "prifunct",
"body": [
"/**",
" * ${1:Description}",
" *",
" * @return ${2:return type}",
" */",
"private function ${3:functionName}($4)",
"{",
" // code away brother$0",
"}"
],
"description": "Generates a PSR-2 formatted private function stub"
},
"Make a PSR-2 private property for class": {
"prefix": "priprop",
"body": [
"/**",
" * $1",
" *",
" * @var $2",
" */",
"private $0"
],
"description": "Generate a PSR-2 formatted private property"
},
"Make a PSR-2 protected property for class": {
"prefix": "proprop",
"body": [
"/**",
" * $1",
" *",
" * @var $2",
" */",
"protected $0"
],
"description": "Generate a PSR-2 formatted protected property"
},
"Make a PSR-2 public property for class": {
"prefix": "pubprop",
"body": [
"/**",
" * $1",
" *",
" * @var $2",
" */",
"protected $0"
],
"description": "Generate a PSR-2 formatted public property"
},
"Make a laravel test function": {
"prefix": "laratest",
"body": [
"/**",
" * ${1:Description}",
" *",
" * @return void",
" */",
"public function test${2:NameOfTest}()",
"{",
" assert(true);$0",
"}"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment