Merge pull request #282 from chrisyue/master

[php] [symfony] some bugfix and improve
This commit is contained in:
Honza Pokorny 2013-09-25 10:16:12 -07:00
commit 665d9d39c3
2 changed files with 13 additions and 8 deletions

View File

@ -62,14 +62,15 @@ ${1:public} function __construct($2)
endsnippet
snippet sg "Setter and Getter" b
/**
* @var ${3:`!p snip.rv = t[2].capitalize()`}
* @var ${3:`!p snip.rv = t[2][0:1].upper() + t[2][1:]`}
*
* ${4}
*/
${1:protected} $$2;
${1:protected} $${2};
public function set`!p snip.rv = t[2].capitalize()`(`!p
if re.match(r'[A-Z].*', t[3]):
public function set`!p snip.rv = t[2][0:1].upper() + t[2][1:]`(`!p
if re.match(r'^(\\|[A-Z]).*', t[3]):
snip.rv = t[3] + ' '
else:
snip.rv = ''
@ -80,7 +81,7 @@ else:
return $this;
}
public function get`!p snip.rv = t[2].capitalize()`()
public function get`!p snip.rv = t[2][0:1].upper() + t[2][1:]`()
{
return $this->$2;
}

View File

@ -33,7 +33,7 @@ snippet act "symfony2 action" b
public function ${1}Action(${2})
{
${6}
return $this->redirect($this->generate('home', [], false));
return $this->redirect($this->generateUrl('home', [], false));
}
endsnippet
@ -175,7 +175,11 @@ tmp = re.sub(r'\B([A-Z])', r'_\1', tmp)
snip.rv = tmp.lower()
`")
*/
class `!p
`!p
m = re.search(r'Abstract', path)
if m:
snip.rv = 'abstract '
`class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
`
{