Updated PHPUnit, Symfony and Laravel class snippets to be consistent

with existing PHP snippets' namespace and adding `<?php`

Changed PHPUnit and Symfony snippet's namespace and author to be consistent with other PHP snippets

class

blah
This commit is contained in:
Mathew Attlee 2016-04-30 11:28:18 +01:00
parent 042aec6f06
commit 05b7e5c4e2
3 changed files with 60 additions and 28 deletions

View File

@ -36,6 +36,8 @@ endsnippet
#service service provider #service service provider
snippet l_ssp "Laravel service provider for service" b snippet l_ssp "Laravel service provider for service" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $2 * \class $2
@ -62,6 +64,8 @@ endsnippet
#repository service provider #repository service provider
snippet l_rsp "Laravel service provider for repository" b snippet l_rsp "Laravel service provider for repository" b
<?php
/*! /*!
* \namespace $2 * \namespace $2
* \class $3 * \class $3
@ -100,6 +104,8 @@ endsnippet
#model #model
snippet l_md "Laravel simple model" b snippet l_md "Laravel simple model" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $2 * \class $2
@ -123,6 +129,8 @@ endsnippet
#abstract repository #abstract repository
snippet l_ar "Laravel abstract Repository" b snippet l_ar "Laravel abstract Repository" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $2 * \class $2
@ -189,6 +197,8 @@ endsnippet
#repository #repository
snippet l_r "Laravel Repository" b snippet l_r "Laravel Repository" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $3 * \class $3
@ -207,6 +217,8 @@ endsnippet
#service #service
snippet l_s "Laravel Service" b snippet l_s "Laravel Service" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $2 * \class $2
@ -233,6 +245,8 @@ endsnippet
#facade #facade
snippet l_f "Laravel Facade" b snippet l_f "Laravel Facade" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $2 * \class $2

View File

@ -3,15 +3,17 @@
priority -50 priority -50
snippet test "phpunit test class" b snippet test "phpunit test class" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
/** /**
* @author `whoami` * @author `!v g:snips_author`
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()

View File

@ -4,15 +4,17 @@
priority -50 priority -50
snippet classn "Basic class with namespace snippet" b snippet classn "Basic class with namespace snippet" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
/** /**
* ${1:@author `whoami`} * ${1:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -26,9 +28,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet contr "Symfony2 controller" b snippet contr "Symfony2 controller" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -40,7 +44,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
* ${1:@author `whoami`} * ${1:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -72,13 +76,15 @@ public function ${1}Action(${2})
${6} ${6}
return []; return [];
}`!p }`!p
abspath = os.path.abspath(path)` relpath = os.path.relpath(path)`
endsnippet endsnippet
snippet comm "Symfony2 command" b snippet comm "Symfony2 command" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -90,7 +96,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
/** /**
* ${3:@author `whoami`} * ${3:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -113,9 +119,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet subs "Symfony2 subscriber" b snippet subs "Symfony2 subscriber" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -123,7 +131,7 @@ if m:
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/** /**
* ${1:@author `whoami`} * ${1:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -144,9 +152,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet transf "Symfony2 form data transformer" b snippet transf "Symfony2 form data transformer" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -155,7 +165,7 @@ use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Exception\TransformationFailedException;
/** /**
* ${3:@author `whoami`} * ${3:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -178,9 +188,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet ent "Symfony2 doctrine entity" b snippet ent "Symfony2 doctrine entity" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -188,7 +200,7 @@ if m:
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* ${3:@author `whoami`} * ${3:@author `!v g:snips_author`}
* *
* @ORM\Entity() * @ORM\Entity()
* @ORM\Table(name="`!p * @ORM\Table(name="`!p
@ -215,9 +227,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet form "Symfony2 form type" b snippet form "Symfony2 form type" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -227,7 +241,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/** /**
* ${2:@author `whoami`} * ${2:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -259,9 +273,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet ev "Symfony2 event" b snippet ev "Symfony2 event" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -269,7 +285,7 @@ if m:
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
/** /**
* ${2:@author `whoami`} * ${2:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()