dotfiles/vim/vim.symlink/UltiSnips/php.snippets
2017-01-25 13:23:13 +00:00

86 lines
1.4 KiB
Text

global !p
from mbutils import get_namespace, format_method
import os
def full_path(filename):
cwd = os.getcwd()
filepath = os.path.join(cwd, filename)
return os.path.dirname(filepath)
endglobal
snippet class
<?php
/**
* @copyright Copyright 2017 ${1:Redbox Digital}
*/
namespace ${2:`!p snip.rv = get_namespace(full_path(path))`};
${3:// Use...}
class ${4:`!p snip.rv = snip.basename`}${5: extends ${6:ParentClass}}${7: implements ${8:SomeInterface, OtherInterface}}
\{
${0:// Implementation...}
\}
endsnippet
snippet interface
<?php
/**
* @copyright Copyright 2017 ${1:Redbox Digital}
*/
namespace ${2:`!p snip.rv = get_namespace(full_path(path))`};
${3:// Use...}
interface ${4:`!p snip.rv = snip.basename`}${5: extends ${6:ParentInterface}}
\{
${0:// Interface...}
\}
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:@tags}
*/
public function ${1:methodName}(
...\$args
):returnType \{
$0
\}
endsnippet
snippet prof
protected function ${1}(
${2}
) \{
$0
\}
endsnippet
snippet prif
private function ${1}(
${2}
) \{
$0
\}
endsnippet
snippet @param
@param ${1:Type}${2:|null} \$${3:name} ${4:Description}
endsnippet