2016-11-30 09:35:05 +00:00
|
|
|
snippet - "" i
|
2020-09-20 05:22:17 +00:00
|
|
|
->$0
|
2016-11-30 09:35:05 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet = "" i
|
2020-09-20 05:22:17 +00:00
|
|
|
=>$0
|
2016-11-30 09:35:05 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
2020-09-20 05:22:17 +00:00
|
|
|
snippet this "Description" i
|
|
|
|
|
$this->$0
|
2016-11-30 09:35:05 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
2020-09-20 05:22:17 +00:00
|
|
|
snippet dd "Dumb debug helper in HTML"
|
|
|
|
|
echo '<pre>' . var_dump($1, 1) . '</pre>';$0
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet dump "Symfony Dump" i
|
|
|
|
|
dump(${1:var});
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet dumpd "Symfony Dump Die" i
|
|
|
|
|
dump(${1:var});
|
|
|
|
|
die;
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet rdd "Revo die var" i
|
|
|
|
|
\revo\Revo::dieVar(${1:var});
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet ai "Array item" i
|
|
|
|
|
'${1:key}' => ${0:value}
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet try "Try and catch block" b
|
|
|
|
|
try {
|
|
|
|
|
$0
|
|
|
|
|
} catch (\Exception $e) {}
|
2016-11-30 09:35:05 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet pub "Public function" b
|
|
|
|
|
/**
|
|
|
|
|
* ${3:undocumented function}
|
|
|
|
|
*
|
2020-09-20 05:22:17 +00:00
|
|
|
* @return $4
|
2016-11-30 09:35:05 +00:00
|
|
|
*/
|
2020-09-20 05:22:17 +00:00
|
|
|
public function ${1:name}(${2:$param})${3:: ${4:void}}
|
2016-11-30 09:35:05 +00:00
|
|
|
{
|
2020-09-20 05:22:17 +00:00
|
|
|
${VISUAL}$0
|
2016-11-30 09:35:05 +00:00
|
|
|
}
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet pro "Protected function" b
|
|
|
|
|
/**
|
|
|
|
|
* ${3:undocumented function}
|
|
|
|
|
*
|
2020-09-20 05:22:17 +00:00
|
|
|
* @return $4
|
2016-11-30 09:35:05 +00:00
|
|
|
*/
|
2020-09-20 05:22:17 +00:00
|
|
|
protected function ${1:name}(${2:$param})${3:: ${4:void}}
|
2016-11-30 09:35:05 +00:00
|
|
|
{
|
2020-09-20 05:22:17 +00:00
|
|
|
${VISUAL}$0
|
2016-11-30 09:35:05 +00:00
|
|
|
}
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet pri "Private function" b
|
|
|
|
|
/**
|
|
|
|
|
* ${3:undocumented function}
|
|
|
|
|
*
|
2020-09-20 05:22:17 +00:00
|
|
|
* @return $4
|
2016-11-30 09:35:05 +00:00
|
|
|
*/
|
2020-09-20 05:22:17 +00:00
|
|
|
private function ${1:name}(${2:$param})${3:: ${4:void}}
|
2016-11-30 09:35:05 +00:00
|
|
|
{
|
2020-09-20 05:22:17 +00:00
|
|
|
${VISUAL}$0
|
2016-11-30 09:35:05 +00:00
|
|
|
}
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet pubs "Public static function" b
|
|
|
|
|
/**
|
|
|
|
|
* ${3:undocumented function}
|
|
|
|
|
*
|
2020-09-20 05:22:17 +00:00
|
|
|
* @return $4
|
2016-11-30 09:35:05 +00:00
|
|
|
*/
|
2020-09-20 05:22:17 +00:00
|
|
|
public static function ${1:name}(${2:$param})${3:: ${4:void}}
|
2016-11-30 09:35:05 +00:00
|
|
|
{
|
2020-09-20 05:22:17 +00:00
|
|
|
${VISUAL}$0
|
2016-11-30 09:35:05 +00:00
|
|
|
}
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet pros "Protected static function" b
|
|
|
|
|
/**
|
|
|
|
|
* ${3:undocumented function}
|
|
|
|
|
*
|
2020-09-20 05:22:17 +00:00
|
|
|
* @return $4
|
2016-11-30 09:35:05 +00:00
|
|
|
*/
|
2020-09-20 05:22:17 +00:00
|
|
|
protected static function ${1:name}(${2:$param})${3:: ${4:void}}
|
2016-11-30 09:35:05 +00:00
|
|
|
{
|
2020-09-20 05:22:17 +00:00
|
|
|
${VISUAL}$0
|
2016-11-30 09:35:05 +00:00
|
|
|
}
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet pris "Private static function" b
|
|
|
|
|
/**
|
|
|
|
|
* ${3:undocumented function}
|
|
|
|
|
*
|
2020-09-20 05:22:17 +00:00
|
|
|
* @return $4
|
2016-11-30 09:35:05 +00:00
|
|
|
*/
|
2020-09-20 05:22:17 +00:00
|
|
|
private static function ${1:name}(${2:$param})${3:: ${4:void}}
|
2016-11-30 09:35:05 +00:00
|
|
|
{
|
2020-09-20 05:22:17 +00:00
|
|
|
${VISUAL}$0
|
2016-11-30 09:35:05 +00:00
|
|
|
}
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet new "New class instance" b
|
|
|
|
|
$${1:variableName} = new ${2:${1/\w+\s*/\u$0/}}($3);
|
|
|
|
|
$0
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet ns "namespace declaration" b
|
|
|
|
|
namespace ${1:`!p
|
|
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
|
|
|
if m:
|
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
|
`};
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet class "Class declaration template" b
|
|
|
|
|
<?php
|
|
|
|
|
|
2020-09-20 05:22:17 +00:00
|
|
|
declare(strict_types = 1);
|
|
|
|
|
|
2016-11-30 09:35:05 +00:00
|
|
|
namespace ${1:`!p
|
|
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
|
|
|
if m:
|
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
|
`};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author ${2:`!v g:snips_author`}
|
|
|
|
|
*/
|
2020-09-20 05:22:17 +00:00
|
|
|
class ${3:`!p snip.rv=snip.basename`}${4: extends ${5}}
|
2016-11-30 09:35:05 +00:00
|
|
|
{
|
2020-09-20 05:22:17 +00:00
|
|
|
${0}
|
2016-11-30 09:35:05 +00:00
|
|
|
}
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet interface "Interface 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`}
|
|
|
|
|
*/
|
|
|
|
|
interface $1
|
|
|
|
|
{
|
|
|
|
|
public function ${3:someFunction}();$4
|
|
|
|
|
}
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
snippet construct "__construct()" b
|
|
|
|
|
/**
|
|
|
|
|
* @param $2mixed ${1/, /\n * \@param mixed /g}
|
|
|
|
|
*/
|
|
|
|
|
public function __construct(${1:$dependencies})
|
|
|
|
|
{${1/\$(\w+)(, )*/\n $this->$1 = $$1;/g}
|
|
|
|
|
}
|
|
|
|
|
$0
|
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
# PHPUnit snippets
|
|
|
|
|
snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }"
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace `!p
|
|
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
|
|
|
|
if m:
|
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author `!v g:snips_author`
|
|
|
|
|
*/
|
|
|
|
|
class `!p
|
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
|
` extends \PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
|
|
|
|
public function test${1}()
|
|
|
|
|
{
|
|
|
|
|
${0:${VISUAL}}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
endsnippet
|