Skip to content

[php] [symfony] some bugfix and improve #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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