Split out snippets
This commit is contained in:
parent
e7320c34c9
commit
ad82a03dfd
2 changed files with 84 additions and 63 deletions
|
@ -40,66 +40,3 @@ interface ${4:`!p snip.rv = snip.basename`}${5: extends ${6:ParentInterface}}
|
||||||
${0:// Interface...}
|
${0:// Interface...}
|
||||||
\}
|
\}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet f
|
|
||||||
function ${1}(
|
|
||||||
${2}
|
|
||||||
) \{
|
|
||||||
$0
|
|
||||||
\}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
post_jump "if (snip.tabstop == 0): format_method(snip)"
|
|
||||||
snippet pubf
|
|
||||||
/**
|
|
||||||
* ${2:Short description...}
|
|
||||||
*
|
|
||||||
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
|
||||||
*
|
|
||||||
* ${4:@api}
|
|
||||||
* ${5:@params}
|
|
||||||
* @return ${6:ReturnType}
|
|
||||||
* ${7:@throws ${8:ExceptionType}}
|
|
||||||
*/
|
|
||||||
public function ${1:methodName}(
|
|
||||||
...\$args
|
|
||||||
): `!p snip.rv = map_type(t[6])` \{
|
|
||||||
$0
|
|
||||||
\}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet prof
|
|
||||||
/**
|
|
||||||
* ${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
|
|
||||||
\}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet prif
|
|
||||||
/**
|
|
||||||
* ${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
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet @param
|
|
||||||
@param ${1:Type}${2:|null} ${3:name} ${4:Description}
|
|
||||||
endsnippet
|
|
||||||
|
|
84
vim/vim.symlink/UltiSnips/php_methods.snippets
Normal file
84
vim/vim.symlink/UltiSnips/php_methods.snippets
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
# Python
|
||||||
|
#
|
||||||
|
# `mbutils` is a collection of tooling I've built to do some intelligent
|
||||||
|
# stuff around PHP tooling.
|
||||||
|
# Found in lib/python/mbutils.py
|
||||||
|
global !p
|
||||||
|
from mbutils import get_namespace, format_method, map_type, prepare_arguments
|
||||||
|
import os
|
||||||
|
|
||||||
|
def full_path(filename):
|
||||||
|
cwd = os.getcwd()
|
||||||
|
filepath = os.path.join(cwd, filename)
|
||||||
|
|
||||||
|
return os.path.dirname(filepath)
|
||||||
|
endglobal
|
||||||
|
|
||||||
|
# @param
|
||||||
|
#
|
||||||
|
# To make param generation a little easier.
|
||||||
|
snippet @param
|
||||||
|
@param ${1:Type}${2:|null} ${3:name} ${4:Description}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# Public method.
|
||||||
|
#
|
||||||
|
# Forces me to write a really good docblock.
|
||||||
|
post_jump "if (snip.tabstop == 0): format_method(snip)"
|
||||||
|
snippet pubf
|
||||||
|
/**
|
||||||
|
* ${2:Short description...}
|
||||||
|
*
|
||||||
|
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
||||||
|
*
|
||||||
|
* ${4:@api}
|
||||||
|
* ${5:@params}
|
||||||
|
* @return ${6:ReturnType}
|
||||||
|
* ${7:@throws ${8:ExceptionType}}
|
||||||
|
*/
|
||||||
|
public function ${1:methodName}(
|
||||||
|
...\$args
|
||||||
|
): `!p snip.rv = map_type(t[6])` \{
|
||||||
|
$0
|
||||||
|
\}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# Private method. As public.
|
||||||
|
post_jump "if (snip.tabstop == 0): format_method(snip)"
|
||||||
|
snippet prif
|
||||||
|
/**
|
||||||
|
* ${2:Short description...}
|
||||||
|
*
|
||||||
|
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
||||||
|
*
|
||||||
|
* ${4:@api}
|
||||||
|
* ${5:@params}
|
||||||
|
* @return ${6:ReturnType}
|
||||||
|
* ${7:@throws ${8:ExceptionType}}
|
||||||
|
*/
|
||||||
|
private function ${1:methodName}(
|
||||||
|
...\$args
|
||||||
|
): `!p snip.rv = map_type(t[6])` \{
|
||||||
|
$0
|
||||||
|
\}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
# Protected method. As public.
|
||||||
|
post_jump "if (snip.tabstop == 0): format_method(snip)"
|
||||||
|
snippet prof
|
||||||
|
/**
|
||||||
|
* ${2:Short description...}
|
||||||
|
*
|
||||||
|
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
||||||
|
*
|
||||||
|
* ${4:@api}
|
||||||
|
* ${5:@params}
|
||||||
|
* @return ${6:ReturnType}
|
||||||
|
* ${7:@throws ${8:ExceptionType}}
|
||||||
|
*/
|
||||||
|
protected function ${1:methodName}(
|
||||||
|
...\$args
|
||||||
|
): `!p snip.rv = map_type(t[6])` \{
|
||||||
|
$0
|
||||||
|
\}
|
||||||
|
endsnippet
|
Loading…
Add table
Reference in a new issue