From 5b86f089dc149d4b1586cf980dfc90ee3d2c8f99 Mon Sep 17 00:00:00 2001 From: Julien Deniau Date: Fri, 30 Jan 2015 15:25:14 +0100 Subject: [PATCH] Update PHP getter setter Add return / parameter types Set @param and @return --- UltiSnips/php.snippets | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index def2116..366346a 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -102,44 +102,54 @@ var_export(${1});${2} endsnippet snippet getter "PHP Class Getter" b -/* +/** * Getter for $1 + * + * ${2:return string} */ public function get${1/\w+\s*/\u$0/}() { - return $this->$1;$2 + return $this->$1;$3 } -$4 +$0 endsnippet snippet setter "PHP Class Setter" b -/* +/** * Setter for $1 + * + * @param ${2:string} $$1 + * @return ${3:`!p snip.rv=snip.basename`} */ -public function set${1/\w+\s*/\u$0/}($$1) +public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) { - $this->$1 = $$1;$3 - ${4:return $this;} + $this->$1 = $$1;$5 + ${6:return $this;} } $0 endsnippet snippet gs "PHP Class Getter Setter" b -/* +/** * Getter for $1 + * + * return ${2:string} */ public function get${1/\w+\s*/\u$0/}() { - return $this->$1;$2 + return $this->$1;$3 } -/* +/** * Setter for $1 + * + * @param $2 $$1 + * @return ${4:`!p snip.rv=snip.basename`} */ -public function set${1/\w+\s*/\u$0/}($$1) +public function set${1/\w+\s*/\u$0/}(${5:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) { - $this->$1 = $$1;$3 - ${4:return $this;} + $this->$1 = $$1;$6 + ${7:return $this;} } $0 endsnippet