Merge pull request #722 from codeinabox/php-trait
Trait snippet for PHP + moved `sfa` snippet into php-symfony2
This commit is contained in:
commit
2a1fa24d68
@ -53,6 +53,18 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet sfa "Symfony 2 Controller action"
|
||||
/**
|
||||
* @Route("/${1:route_name}", name="$1")
|
||||
* @Template()
|
||||
*/
|
||||
public function $1Action($2)
|
||||
{
|
||||
$3
|
||||
return ${4:array();}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet act "Symfony2 action" b
|
||||
/**
|
||||
* @Route("${3}", name="${4}")
|
||||
|
@ -314,6 +314,24 @@ interface $1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet trait "Trait declaration template" b
|
||||
<?php
|
||||
|
||||
namespace ${1:`!p
|
||||
relpath = os.path.relpath(path)
|
||||
m = re.search(r'[A-Z].+(?=/)', relpath)
|
||||
if m:
|
||||
snip.rv = m.group().replace('/', '\\')
|
||||
`};
|
||||
|
||||
/**
|
||||
* Interface ${1:`!p snip.rv=snip.basename`}
|
||||
* @author ${2:`!v g:snips_author`}
|
||||
*/
|
||||
trait $1
|
||||
{
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet construct "__construct()" b
|
||||
/**
|
||||
@ -333,19 +351,6 @@ snippet pc "Dumb debug helper in cli"
|
||||
var_export($1);$0
|
||||
endsnippet
|
||||
|
||||
# Symfony 2 based snippets
|
||||
snippet sfa "Symfony 2 Controller action"
|
||||
/**
|
||||
* @Route("/${1:route_name}", name="$1")
|
||||
* @Template()
|
||||
*/
|
||||
public function $1Action($2)
|
||||
{
|
||||
$3
|
||||
return ${4:array();}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet inheritdoc "@inheritdoc docblock"
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -218,6 +218,18 @@ snippet interface
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# Trait
|
||||
snippet trait
|
||||
/**
|
||||
* ${2:undocumented class}
|
||||
*
|
||||
* @package ${3:default}
|
||||
* @author ${4:`g:snips_author`}
|
||||
*/
|
||||
trait ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# class ...
|
||||
snippet class
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user