Created
January 6, 2015 07:18
-
-
Save tamakiii/cff61a78f8245b127e16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| snippet -> | |
| options word | |
| $this->${1:...} | |
| snippet [] | |
| options word | |
| array(${1}); | |
| snippet instanceof | |
| options word | |
| ${1:...} instanceof ${2:...} | |
| snippet interface_file | |
| <?php | |
| namespace ${1:...}; | |
| /** | |
| * ${2} | |
| */ | |
| interface ${3:...} | |
| { | |
| ${0} | |
| } | |
| snippet interface_method | |
| alias method_interface | |
| alias public_interface_method | |
| /** | |
| * ${0} | |
| */ | |
| ${1:public} function ${2:...}(${3}); | |
| snippet class_file | |
| <?php | |
| namespace ${1:...}; | |
| /** | |
| * ${2} | |
| */ | |
| class ${3:...} | |
| { | |
| ${0} | |
| } | |
| snippet class_method | |
| alias method_class | |
| alias public_class_method | |
| /** | |
| * ${4} | |
| */ | |
| ${1:public} function ${2:...}(${3}) | |
| { | |
| ${0} | |
| } | |
| snippet class_var | |
| alias var_class | |
| /** | |
| * @var ${1} | |
| */ | |
| ${2:private} $${3:...}; | |
| snippet doc_param | |
| alias @param | |
| /** | |
| * @param ${1} $${2} | |
| */ | |
| snippet doc_param_return | |
| alias @param_return | |
| alias @pr | |
| /** | |
| * @param ${1} $${2}${0} | |
| * @return ${3} | |
| */ | |
| snippet closure | |
| function(${1}) ${2: use } { | |
| ${3:TARGET} | |
| }; | |
| snippet if | |
| options head | |
| if (${1:#:...}) { | |
| ${0} | |
| } | |
| snippet else | |
| else { | |
| ${0:TARGET} | |
| } | |
| snippet elseif | |
| elseif (${1:#:condition}) { | |
| ${0:TARGET} | |
| } | |
| snippet for | |
| options head | |
| for ($${1:i}=${2:0}; $$1 < ${3}; $$1++) { | |
| ${0:TARGET} | |
| } | |
| snippet foreach | |
| foreach ($${1:#:variable} as $${2:#:key}${3: =>} $${4:#:value}) { | |
| ${0:TARGET} | |
| } | |
| snippet var_dump | |
| alias dump | |
| options head | |
| var_dump(${0}); | |
| snippet content_type | |
| header("Content-type: ${1:text/plain;}");${0} | |
| snippet throw | |
| options head | |
| throw new ${1}Exception(${2:"${3:#:Error Processing Request}"}${4:}); | |
| ${0} | |
| snippet phake_mock | |
| alias mock_phake | |
| Phake::mock('${1}'); | |
| snippet phake_when | |
| alias when_phake | |
| Phake::when(${1}) | |
| ->${2}(${3}) | |
| ->then${4}(${5}); | |
| snippet phake_verify | |
| alias verify_phake | |
| Phake::verify($${1:#:mock}, Phake::times(${2:#:0})) | |
| ->${3}(${4}); | |
| snippet test_class | |
| <?php | |
| namespace ${1:...}; | |
| use ${2:...}; | |
| ${3:use Phake;} | |
| /** | |
| * Tests for ${4}. | |
| */ | |
| class ${5:...} extends \PHPUnit_Framework_TestCase | |
| { | |
| /** | |
| * Set up | |
| */ | |
| public function setUp() | |
| { | |
| ${6} | |
| } | |
| } | |
| snippet test_interface | |
| <?php | |
| namespace ${1:...}; | |
| use Phake; | |
| /** | |
| * Tests for ${2}. | |
| */ | |
| class ${3:...} extends \PHPUnit_Framework_TestCase | |
| { | |
| /** | |
| * @test | |
| */ | |
| public function ${5:canUse}() | |
| { | |
| Phake::mock('${6:...}'); | |
| } | |
| } | |
| snippet test_method | |
| alias @test | |
| /** | |
| * @test | |
| */ | |
| public function ${1:...}() | |
| { | |
| ${0} | |
| } | |
| snippet test_data_provider | |
| alias data_provider_method | |
| /** | |
| * @return array | |
| */ | |
| public function ${1:...}DataProvider() | |
| { | |
| return array( | |
| array(${0}), | |
| ); | |
| } | |
| snippet test_assert_instanceof | |
| alias assert_instanceof | |
| $this->assertInstanceOf( | |
| '${1:...}', | |
| ${0:...} | |
| ); | |
| snippet test_assert_same | |
| alias assert_same | |
| $this->assertSame( | |
| ${1:...}, | |
| ${2:...} | |
| ); | |
| snippet test_assert_true | |
| alias assert_true | |
| $this->asssertTrue(${1:...}); | |
| snippet test_assert_false | |
| alias assert_false | |
| $this->asssertFalse(${1:...}); | |
| snippet service_provider | |
| <?php | |
| namespace ${1}; | |
| /** | |
| * ${2}service provider. | |
| */ | |
| class ${3}ServiceProvider implements \Pimple\ServiceProviderInterface | |
| { | |
| /** | |
| * @param \Pimple\Container $container | |
| */ | |
| public function register(\Pimple\Container $container) | |
| { | |
| ${0} | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
基本的な使い方
.vimrcにNeoBundle 'https://github.com/Shougo/neosnippet.vim'と書いて使う:ft = phpで動作するControl+nとControl+pで移動する難のある所
interface-fileだと全部を入力するとダメで、interfaceまで打って Control+n で選択→tabしないとダメよく使うスニペット
[]array();->$this->interface_fileclass_fileclosureservice_providermock_phakePhake::mock('...');when_phakePhake::when($...)->...->then...();test_classtest_interface@testassert_...