Update PHP snippets
This commit is contained in:
parent
8c9659e117
commit
69e6730c50
2 changed files with 33 additions and 11 deletions
|
@ -71,6 +71,9 @@ def get_namespace(dirname):
|
||||||
|
|
||||||
return namespace + convert_path(remainder)
|
return namespace + convert_path(remainder)
|
||||||
|
|
||||||
|
def prepare_arguments(param_tags):
|
||||||
|
arguments = generate_arguments(param_tags)
|
||||||
|
|
||||||
def format_method(snip):
|
def format_method(snip):
|
||||||
'''Convert expanded snippet into method name and args.'''
|
'''Convert expanded snippet into method name and args.'''
|
||||||
params = get_params_map(snip)
|
params = get_params_map(snip)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
global !p
|
global !p
|
||||||
from mbutils import get_namespace, format_method
|
from mbutils import get_namespace, format_method, map_type, prepare_arguments
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def full_path(filename):
|
def full_path(filename):
|
||||||
|
@ -56,31 +56,50 @@ snippet pubf
|
||||||
*
|
*
|
||||||
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
||||||
*
|
*
|
||||||
* ${4:@tags}
|
* ${4:@api}
|
||||||
|
* ${5:@params}
|
||||||
|
* @return ${6:ReturnType}
|
||||||
|
* ${7:@throws ${8:ExceptionType}}
|
||||||
*/
|
*/
|
||||||
public function ${1:methodName}(
|
public function ${1:methodName}(
|
||||||
...\$args
|
...\$args
|
||||||
):returnType \{
|
): `!p snip.rv = map_type(t[6])` \{
|
||||||
$0
|
$0
|
||||||
\}
|
\}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet prof
|
snippet prof
|
||||||
protected function ${1}(
|
/**
|
||||||
${2}
|
* ${2:Short description...}
|
||||||
) \{
|
*
|
||||||
|
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
||||||
|
*
|
||||||
|
* ${4:@api}
|
||||||
|
* ${5:@tags}
|
||||||
|
* @return ${6:ReturnType}
|
||||||
|
* ${7:@throws ${8:ExceptionType}}
|
||||||
|
*/
|
||||||
|
protected function ${1:methodName}(`!p snip.rv = prepare_arguments(t[5])`): `!p snip.rv = map_type(t[6])` \{
|
||||||
$0
|
$0
|
||||||
\}
|
\}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet prif
|
snippet prif
|
||||||
private function ${1}(
|
/**
|
||||||
${2}
|
* ${2:Short description...}
|
||||||
) \{
|
*
|
||||||
|
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
||||||
|
*
|
||||||
|
* ${4:@api}
|
||||||
|
* ${5:@tags}
|
||||||
|
* @return ${6:ReturnType}
|
||||||
|
*/
|
||||||
|
private function ${1:methodName}(
|
||||||
|
...\$args
|
||||||
|
): `!p snip.rv = map_type(t[6])` \{
|
||||||
$0
|
$0
|
||||||
\}
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet @param
|
snippet @param
|
||||||
@param ${1:Type}${2:|null} \$${3:name} ${4:Description}
|
@param ${1:Type}${2:|null} ${3:name} ${4:Description}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
Loading…
Add table
Reference in a new issue