Skip to content

Commit

Permalink
[php] [symfony] some bugfix and improve
Browse files Browse the repository at this point in the history
symfony snippet `ent` now support abstract class
  • Loading branch information
yuhuanbo committed Sep 25, 2013
1 parent 0f61100 commit fe4c59f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
13 changes: 7 additions & 6 deletions UltiSnips/php.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand All @@ -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;
}
Expand Down
8 changes: 6 additions & 2 deletions UltiSnips/php/symfony2.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
`
{
Expand Down

0 comments on commit fe4c59f

Please sign in to comment.